Decoder Constructor ()

 

Initializes a new instance of the Decoder class.

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

protected:
Decoder()

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

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

using namespace System;
using namespace System::Text;
int main()
{

   // A Decoder is obtained from an Encoding.
   UnicodeEncoding^ uni = gcnew 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 );
   Console::WriteLine( dec2 );

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

/* This code example produces the following output.

System.Text.UnicodeEncoding+Decoder
System.Text.UnicodeEncoding+Decoder
54267293
18643596

*/

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: