
Untitled
By: a guest on
Aug 30th, 2012 | syntax:
None | size: 0.80 KB | hits: 9 | expires: Never
using System;
namespace Theory10
{
/// <summary>
/// Class ExtensionExample defines the extension method
/// </summary>
static class ExtensionExample
{
// Extension Method to convert the fist character to
// lowercase
public static string FirstLetterLower(this string result)
{
if (result.Length > 0)
{
char[] s = result.ToCharArray();
s[0] = char.ToLower(s[0]);
return new string(s);
}
return result;
}
}
class Run
{
public static void Main(string[] args)
{
string country = "Great Britain";
// Calling the extension method
Console.WriteLine(country.FirstLetterLower());
}
}
}