UTF7Encoding Constructor ()

 

Initializes a new instance of the UTF7Encoding class.

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

public UTF7Encoding()

This constructor creates an instance that does not allow optional characters. Calling the UTF7Encoding constructor is equivalent to calling the UTF7Encoding.UTF7Encoding(Boolean) constructor that takes an allowOptionals parameter and specifying false for that parameter.

If an instance allows optional characters, Unicode code points are encoded with a corresponding optional character instead of a modified base 64 character. The optional characters are exclamation point ("!"), backward slash ("\"), vertical line ("|"), double quote ("""), number sign ("#"), dollar sign ("$"), percent sign ("%"), ampersand ("&"), asterisk ("*"), semicolon (";"), left angle bracket ("<"), right angle bracket (">"), left curly bracket ("{"), right curly bracket ("}"), left square bracket ("["), right square bracket ("]"), equal sign ("="), at sign ("@"), circumflex accent ("^"), underscore ("_"), and grave accent ("`").

System_CAPS_noteNote

UTF7Encoding does not provide error detection. For security reasons, your applications are recommended to use UTF8Encoding, UnicodeEncoding, or UTF32Encoding and enable error detection.

The following code example demonstrates how to create a new UTF7Encoding instance and display the name of the encoding.

using System;
using System.Text;

class UTF7EncodingExample {
    public static void Main() {
        UTF7Encoding utf7 = new UTF7Encoding();
        String encodingName = utf7.EncodingName;
        Console.WriteLine("Encoding name: " + encodingName);
    }
}

Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Return to top
Show: