Decoder Konstruktor
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Initierar en ny instans av Decoder klassen.
protected:
Decoder();
protected Decoder();
Protected Sub New ()
Exempel
I följande exempel visas två metoder för att initiera en ny Decoder instans.
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());
}
}
/* This code example produces the following output.
System.Text.UnicodeEncoding+Decoder
System.Text.UnicodeEncoding+Decoder
58225482
54267293
*/
Imports System.Text
Class EncoderExample
Public Shared Sub Main()
' A Decoder is obtained from an Encoding.
Dim uni As New UnicodeEncoding()
Dim dec1 As Decoder = uni.GetDecoder()
' A more direct technique.
Dim dec2 As Decoder = 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())
End Sub
End Class
'This code example produces the following output.
'System.Text.UnicodeEncoding+Decoder
'System.Text.UnicodeEncoding+Decoder
'58225482
'54267293
'
Kommentarer
För att få en instans av en implementering av den här klassen bör programmet använda GetDecoder metoden för en Encoding implementering.