Here is the Encoding.ASCII
implement detail (from Encoding.cs):
private static volatile Encoding asciiEncoding;
public static Encoding ASCII
{
{
if (Encoding.asciiEncoding == null)
Encoding.asciiEncoding = (Encoding) new ASCIIEncoding();
return Encoding.asciiEncoding;
}
}
The main difference is the return type differs, which depends on what type you wish to use (ASCIIEncoding
vs Encoding
), and Encoding
is the base class.
From a performance perspective, Encoding.ASCII
is the preference.