C# Extension Method Class Example

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MyNameSpace
{
public static class ExtensionMethods
{
public static string EmptyStringSingleQuoted(this string s)
{
if (s == String.Empty)
{
return “””;
}
else
{
return s;
}
}
}
}

Author: Travis Gneiting

Passionate Professional .NET Developer