This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
container.Kernel.ComponentModelCreated += model => | |
{ | |
if (model.LifestyleType == LifestyleType.Undefined) | |
model.LifestyleType = LifestyleType.Transient; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |