Char - IsControl
Indicates whether the specified Unicode character is categorized as a control character.
public static void Main() { char [] input = {'E','F','\n','E','F','6','\n','\r'}; Console.WriteLine("{0}:\t{1}", "Index", "Is Control"); for (int i = 0; i < input.Length; i++) { // C# Extension Method: Char - IsControl var result = input[i].IsControl(); Console.WriteLine("{0}:\t\t{1}", i, result); } }
View Source
using System; public static partial class Extensions { /// <summary> /// Indicates whether the specified Unicode character is categorized as a control character. /// </summary> /// <param name="c">The Unicode character to evaluate.</param> /// <returns>true if is a control character; otherwise, false.</returns> public static Boolean IsControl(this Char c) { return Char.IsControl(c); } }