| c# Programming Glossary: extensionmethodsHow to create JSON string in C# http://stackoverflow.com/questions/1056121/how-to-create-json-string-in-c-sharp  an useful extension method. Code from article namespace ExtensionMethods public static class JSONHelper  public static string ToJSON.. return serializer.Serialize obj  Usage using ExtensionMethods ... List Person people new List Person  new Person ID 1 FirstName.. 
 C#: File-size format provider http://stackoverflow.com/questions/128618/c-file-size-format-provider  method to get the result you want public static class ExtensionMethods public static string ToFileSize this long l  return String.Format.. 
 General purpose FromEvent method http://stackoverflow.com/questions/12865848/general-purpose-fromevent-method  Target Delegate public static class ExtensionMethods private static Dictionary Type DynamicMethod s_emittedHandlers.. 
 Interesting “params of ref” feature, any workarounds? http://stackoverflow.com/questions/1776020/interesting-params-of-ref-feature-any-workarounds  would be possible for value types... public static class ExtensionMethods public static void SetTo this Boolean source params Boolean.. 
 Built in .Net algorithm to round value to the nearest 10 interval http://stackoverflow.com/questions/274439/built-in-net-algorithm-to-round-value-to-the-nearest-10-interval  to use the function much more cleanly. public static class ExtensionMethods public static int RoundOff this int i  return int Math.Round.. function and call the function like so int roundedNumber ExtensionMethods.RoundOff 236 returns 240 int roundedNumber2 ExtensionMethods.RoundOff.. 
 Find sequence in IEnumerable<T> using Linq http://stackoverflow.com/questions/3561776/find-sequence-in-ienumerablet-using-linq  similar to the existing IndexOf method public static class ExtensionMethods public static int IndexOfSequence T this IEnumerable T source.. 
 Adding your own HtmlHelper in ASP.NET MVC 3 http://stackoverflow.com/questions/5052752/adding-your-own-htmlhelper-in-asp-net-mvc-3  way to do this Right now I have this public static class ExtensionMethods public static MvcHtmlString StateDropDownList this HtmlHelper.. You could either call existing helpers public static class ExtensionMethods public static MvcHtmlString StateDropDownList this HtmlHelper.. foo  or return some custom data public static class ExtensionMethods public static MvcHtmlString StateDropDownList this HtmlHelper.. 
 RemoveAll for ObservableCollections? http://stackoverflow.com/questions/5118513/removeall-for-observablecollections  extension method is straight forward public static class ExtensionMethods public static int Remove T this ObservableCollection T coll.. 
 The || (or) Operator in Linq with C# http://stackoverflow.com/questions/772261/the-or-operator-in-linq-with-c-sharp  the following string extension method public static class ExtensionMethods public static bool Contains this string self string value StringComparison.. 
 |