You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ikopylov edited this page Jan 15, 2016
·
2 revisions
Extension Methods
Useful extension methods:
IEnumerable<int>testEnumberable=Enumerable.Range(0,100);// Find the position of element intindex=testEnumberable.FindPosition(elem =>elem==10);// Get item with maximum keyintvalueMax=testEnumerable.MaxBy(elem =>elem);// Get item with minimum keyintvalueMin=testEnumerable.MinBy(elem =>elem);TypetestType=typeof(int);// Test can we assign 'null' to variable of this typebooln1=testType.IsAssignableFromNull();// Get type name in C# formatstringcsName=testType.GetCSName();// Get full type name in C# formatstringcsFullName=testType.GetCSFullName();// Can throw any exception by its typeTurboException.Throw(typeof(ArgumentNullException),"message");TurboException.Throw<ArgumentNullException>("message");