public static string CountryCodeToFlag(this string country)  
     {  
       return string.Concat(country.ToUpper().Select(x => char.ConvertFromUtf32(x + 0x1F1A5)));  
     }  
This is an extension method. so we can use it as below.
 "us".CountryCodeToFlag()  
The result will look like below,
 
No comments:
Post a Comment