Normalize. The Normalize method changes Unicode character sequences. A string's buffer is represented in Unicode. Normalize affects how the Unicode characters are ordered.
We explore how the representations of string data change. This method is not need in many C# programs, but when it is needed, it is important.
This program introduces a string with an accent on the lowercase a. We call Normalize with no parameters, and then Normalize with the parameters NormalizationForm.FormD, FormKC, and FormKD.
Then We print, with Console.WriteLine, the resulting strings to the screen as we go along.
A discussion. Mainly, the Normalize method is useful for interoperability purposes. If you have to interact with another program that uses Unicode, it would be important to call Normalize.
Tip There is no reason to call Normalize if you are just using ASCII or if you are not interoperating with another Unicode form.
Discussion, continued. IsNormalized addresses the need to determine the normalization status of a string. Normalization is necessary when interoperating with other systems.
Detail You can ignore IsNormalized and just leave strings in their default normalization format.
A summary. Normalize() provides interoperation with other systems. It is not a commonly needed string method. But it reveals an important detail of the string implementation.
Dot Net Perls is a collection of pages with code examples, which are updated to stay current. Programming is an art, and it can be learned from examples.
Donate to this site to help offset the costs of running the server. Sites like this will cease to exist if there is no financial support for them.
Sam Allen is passionate about computer languages, and he maintains 100% of the material available on this website. He hopes it makes the world a nicer place.