Char.ToLowerInvariant(Char) Method in C#

The Char.ToLowerInvariant() method in C# is used to convert a Unicode character to its lowercase equivalent using the casing rules of the invariant culture. This method ensures consistent case conversion regardless of the current system culture, making it ideal for culture-independent operations.

Syntax

Following is the syntax −

public static char ToLowerInvariant(char ch);

Parameters

  • ch − The Unicode character to convert to lowercase.

Return Value

Returns the lowercase equivalent of the specified character, or the same character if it has no lowercase equivalent or is already lowercase.

Using ToLowerInvariant with Uppercase Characters

Example

using System;

public class Demo {
    public static void Main() {
        char ch = 'D';
        char res = Char.ToLowerInvariant(ch);
        Console.WriteLine("Value = " + ch);
        Console.WriteLine("Lowercase Equivalent = " + res);
        
        // Test with multiple uppercase characters
        char[] uppercase = {'A', 'Z', 'M'};
        Console.WriteLine("\nMultiple character conversion:");
        foreach(char c in uppercase) {
            Console.WriteLine(c + " -> " + Char.ToLowerInvariant(c));
        }
    }
}

The output of the above code is −

Value = D
Lowercase Equivalent = d

Multiple character conversion:
A -> a
Z -> z
M -> m

Using ToLowerInvariant with Already Lowercase Characters

Example

using System;

public class Demo {
    public static void Main() {
        char ch = 'p';
        char res = Char.ToLowerInvariant(ch);
        Console.WriteLine("Value = " + ch);
        Console.WriteLine("Lowercase Equivalent = " + res);
        
        // Test with numbers and symbols
        char[] mixed = {'5', '@', 'b'};
        Console.WriteLine("\nMixed character types:");
        foreach(char c in mixed) {
            Console.WriteLine(c + " -> " + Char.ToLowerInvariant(c));
        }
    }
}

The output of the above code is −

Value = p
Lowercase Equivalent = p

Mixed character types:
5 -> 5
@ -> @
b -> b

Comparison with ToLower Method

ToLowerInvariant() ToLower()
Uses invariant culture rules Uses current system culture
Culture-independent results Results may vary by locale
Consistent across systems May differ between systems
Best for data processing Best for user interface

Example

using System;
using System.Globalization;

public class Demo {
    public static void Main() {
        char turkishI = 'I';
        
        // Set culture to Turkish for demonstration
        CultureInfo.CurrentCulture = new CultureInfo("tr-TR");
        
        Console.WriteLine("Character: " + turkishI);
        Console.WriteLine("ToLowerInvariant: " + Char.ToLowerInvariant(turkishI));
        Console.WriteLine("ToLower (Turkish): " + Char.ToLower(turkishI));
        
        // Reset to invariant culture
        CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
        Console.WriteLine("ToLower (Invariant): " + Char.ToLower(turkishI));
    }
}

The output of the above code is −

Character: I
ToLowerInvariant: i
ToLower (Turkish): ?
ToLower (Invariant): i

Conclusion

The Char.ToLowerInvariant() method provides culture-independent lowercase conversion, ensuring consistent results across different system locales. Use this method when you need predictable case conversion for data processing, comparisons, or when working with international applications.

Updated on: 2026-03-17T07:04:35+05:30

270 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements