コード例 #1
0
 // Returns an Encoding object for a given name or a given code page value.
 //
 /// <include file='doc\Encoding.uex' path='docs/doc[@for="Encoding.GetEncoding"]/*' />
 public static Encoding GetEncoding(String name)
 {
     //
     // NOTENOTE: If you add a new encoding that can be get by name, be sure to
     // add the corresponding item in EncodingTable.
     // Otherwise, the code below will throw exception when trying to call
     // EncodingTable.GetCodePageFromName().
     //
     return(GetEncoding(EncodingTable.GetCodePageFromName(name)));
 }
コード例 #2
0
        public override Encoding GetEncoding(string name)
        {
            int codepage = EncodingTable.GetCodePageFromName(name);

            if (codepage == 0)
            {
                return(null);
            }

            return(GetEncoding(codepage));
        }