String - Left
A string extension method that return the left part of the string.
public static void Main() { string input = "OneTwoThree"; // C# Extension Method: String - Left string newStr = input.Left(6); Console.WriteLine(newStr); }
View Source
public static partial class Extensions { /// <summary> /// A string extension method that return the left part of the string. /// </summary> /// <param name="this">The @this to act on.</param> /// <param name="length">The length.</param> /// <returns>The left part.</returns> public static string Left(this string @this, int length) { return @this.Substring(0, length); } }