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
LinkedListExtension extension = null; | |
extension.AddFirst(1); | |
Console.WriteLine("No Null Pointer Exception"); |
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
LinkedList<int> extension = null; | |
extension.AddFirst(1); | |
Console.WriteLine("No Null Pointer Exception"); |
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
StaticClass.Method(obj1, obj2); |
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
obj1.Method(obj2) |
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
//Crazify String | |
public static string Crazify(this string word) | |
{ | |
//do crazy things to string | |
} | |
string word = "Normal String"; | |
word.Crazify(); | |
//Insanify Int |
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
//copied from c# standard library | |
public static IEnumerable<TResult> Select<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector); | |
public static IEnumerable<TResult> Select<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, int, TResult> selector); |
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
string uncapitalizedSenence = "this is a sentence"; | |
string capitalizedSentence = uncapitalizedSenence.Capitalize(); | |
//Build Error Message: 'string' does not contain a definition for 'Capitalize' | |
//and no accessible extension method 'Capitalize' accepting a first argument | |
//of type 'string' could be found (are you missing a using directive or an | |
//assembly reference?) |
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 class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
string uncapitalizedSentence = "this is a sentence"; | |
string capitalizedSentence2 = StringHelper.Capitalize(uncapitalizedSentence); | |
} | |
} | |
public static class StringHelper |
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 class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
string uncapitalizedSentence = "this is a sentence"; | |
//no more build error!!!! | |
string capitalizedSentence = uncapitalizedSentence.Capitalize(); | |
} | |
} |
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 TSource First<TSource>(this IEnumerable<TSource> source); | |
public static int? Min(this IEnumerable<int?> source); | |
public static float? Max(this IEnumerable<float?> source); | |
public static IEnumerable<TSource> Where<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate); |
OlderNewer