Skip to content

Instantly share code, notes, and snippets.

View Serg046's full-sized avatar

Sergey Aseev Serg046

View GitHub Profile
class NonZeroNumber {
constructor(readonly num: number) {
if (num === 0) throw 'Value cannot be 0';
}
}
function devide(x: number, y: NonZeroNumber) {
console.log(x / y.num);
}
container.Kernel.ComponentModelCreated += model =>
{
if (model.LifestyleType == LifestyleType.Undefined)
model.LifestyleType = LifestyleType.Transient;
};
public static class ExpressionCombiner
{
public static Expression<Func<T, bool>> And<T>(this Expression<Func<T, bool>> leftExpr, Expression<Func<T, bool>> rightExpr)
{
return Join(leftExpr, rightExpr, Expression.And);
}
public static Expression<Func<T, bool>> Or<T>(this Expression<Func<T, bool>> leftExpr, Expression<Func<T, bool>> rightExpr)
{
return Join(leftExpr, rightExpr, Expression.Or);