Quantcast
Channel: Extension Methods – theburningmonk.com
Browsing index pages (10 articles)

Image may be NSFW.
Clik here to view.

F# – Make extension methods visible to C#

In F# you can write an extension method like this: Whilst this will work perfectly fine in your F# code, the extension method will not be visible to any C# code using the FileInfo type because F# and...

View Article


Image may be NSFW.
Clik here to view.

Extension Methods – Serialize/Deserialize as Json/XML

Cranked these out last night, hope you find it useful too 1: public static class SerializationExtensions 2: { 3: private static readonly ConcurrentDictionary<Type, XmlSerializer> XmlSerializers =...

View Article


Image may be NSFW.
Clik here to view.

Extension Methods – Helpful parse methods for string

1: /// <summary> 2: /// Parses a string as a short 3: /// </summary> 4: public static short ParseShort(this string str, bool throwOnOverflow = true) 5: { 6: return...

View Article

Image may be NSFW.
Clik here to view.

IDictionary to ExpandoObject extension method

As you know, the ExpandoObject class implements the IDictionary<string, object> interface, so if you have an ExpandoObject you can easily cast it to an IDictionary<string, object> but...

View Article

Image may be NSFW.
Clik here to view.

Extension methods to sum IEnumerable(ulong) and IEnumerable(ulong?)

Ever tried to use IEnumerable<T>.Sum on an array of unsigned long integers? Well, you can’t, because the Sum method has not been implemented for ulong or ulong?, so to fill in the gap here’s the...

View Article


F# – Make extension methods visible to C#

In F# you can write an extension method like this: Whilst this will work perfectly fine in your F# code, the extension method will not be visible to any C# code using the FileInfo type because F# and...

View Article

Extension Methods – Serialize/Deserialize as Json/XML

Cranked these out last night, hope you find it useful too 1: public static class SerializationExtensions 2: { 3: private static readonly ConcurrentDictionary<Type, XmlSerializer> XmlSerializers =...

View Article

Extension Methods – Helpful parse methods for string

1: /// <summary> 2: /// Parses a string as a short 3: /// </summary> 4: public static short ParseShort(this string str, bool throwOnOverflow = true) 5: { 6: return...

View Article


IDictionary to ExpandoObject extension method

As you know, the ExpandoObject class implements the IDictionary<string, object> interface, so if you have an ExpandoObject you can easily cast it to an IDictionary<string, object> but...

View Article


Extension methods to sum IEnumerable(ulong) and IEnumerable(ulong?)

Ever tried to use IEnumerable<T>.Sum on an array of unsigned long integers? Well, you can’t, because the Sum method has not been implemented for ulong or ulong?, so to fill in the gap here’s the...

View Article
Browsing index pages (10 articles)


Latest Images