Thanks drew. ASCIIEncoding.ASCII.X() is a little bit like re-stating the obvious. Encoding.ASCII looks a whole lot smooother.
R. -----Original Message----- From: Marsh, Drew [mailto:[EMAIL PROTECTED]] Sent: Thursday, 2 May 2002 12:34 To: [EMAIL PROTECTED] Subject: Re: [DOTNET] Encoding Namespace Question. Rolls, Robert [mailto:[EMAIL PROTECTED]] wrote: > I'm a little bit confused over all the encoding types and the > documentation and I have a query with the following - > > is this equivalent - > > Byte[] a = Encoding.ASCII.GetBytes("Fred"); > Byte[] b = ASCIIEncoding.ASCII.GetBytes("Fred"); > > and the same for UnicodeEncoding, UTF7Encoding, UTF8Encoding? > > The documentation also seems all over the place especially > what public members the class is supposed to expose? Yes they are equivalent. ASCIIEncoding subclasses Encoding and Encoding has a static member (singleton) which is an instance of type ASCIIEncoding. So when you do ASCIIEncoding.ASCII, your really just getting Encoding.ASCII. It's a bit tricky when you first look at it, but if you understand the class design and chain of inheritance it makes sense. Personally, I think using "Encoding.ASCII" in code makes more sense in terms of readability. HTH, Drew You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. **********************************************************************" This correspondence is for the named person's use only. It may contain confidential or legally privileged information or both. " No confidentiality or privilege is waived or lost by any " mistransmission. If you receive this correspondence in error, please immediately delete it from your system and notify the sender. You must not disclose, copy or rely on any part of this correspondence if you are not the intended recipient. Any views expressed in this message are those of the individual sender, except where the sender expressly, and with authority, states them to be the views of Vodafone. This email has been checked for viruses. ********************************************************************************************** You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.