C# EncodingInfo GetEncoding

Description

EncodingInfo GetEncoding Returns a Encoding object that corresponds to the current EncodingInfo object.

Syntax

EncodingInfo.GetEncoding has the following syntax.


public Encoding GetEncoding()

Returns

EncodingInfo.GetEncoding method returns A Encoding object that corresponds to the current EncodingInfo object.

Example

Returns a Encoding object that corresponds to the current EncodingInfo object.


//from  www. j av  a 2  s . c  o  m

using System;
using System.Text;

public class SamplesEncoding  {

   public static void Main()  {
      foreach( EncodingInfo ei in Encoding.GetEncodings() )  {
         Encoding e = ei.GetEncoding();
         Console.Write(ei.Name );
      }
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Text »




ASCIIEncoding
Encoding
EncodingInfo
StringBuilder
UnicodeEncoding
UTF8Encoding