Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Decoder Constructor
Collapse the table of content
Expand the table of content

Decoder Constructor

Initializes a new instance of the Decoder class.

Namespace: System.Text
Assembly: mscorlib (in mscorlib.dll)

protected Decoder ()
protected Decoder ()
protected function Decoder ()

To obtain an instance of an implementation of this class, use the GetDecoder method of an Encoding implementation.

The following code example demonstrates two techniques for initializing a new Decoder instance.

using System;
using System.Text;

class EncoderExample {
    public static void Main() {
        // A Decoder is obtained from an Encoding.
        UnicodeEncoding uni = new UnicodeEncoding();
        Decoder dec1 = uni.GetDecoder();

        // A more direct technique.
        Decoder dec2 = Encoding.Unicode.GetDecoder();

        // dec1 and dec2 seem to be the same.
        Console.WriteLine(dec1.ToString());
        Console.WriteLine(dec2.ToString());

        // Note that their hash codes differ.
        Console.WriteLine(dec1.GetHashCode());
        Console.WriteLine(dec2.GetHashCode());
    }
}

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2015 Microsoft