Search code examples
c#.netwindows-phone-7

Is there any difference between UTF8Encoding.UTF8.GetBytes and Encoding.UTF8.GetBytes?


Today I saw a code in which UTF8Encoding.UTF8.GetBytes and Encoding.UTF8.GetBytes is used. Is there any difference between them?


Solution

  • No difference at all.

    Encoding.UTF8 is UTF8Encoding.

    From MSDN (Encoding.UTF8):

    This property returns a UTF8Encoding object

    Instead of Encoding.UTF8.GetBytes you can simply call UTF8Encoding.GetBytes.