public override unsafe int GetByteCount(char *chars, int count) { return(EncodingForwarder.GetByteCount(this, chars, count)); }
// NOTE: Many methods in this class forward to EncodingForwarder for // validating arguments/wrapping the unsafe methods in this class // which do the actual work. That class contains // shared logic for doing this which is used by // ASCIIEncoding, EncodingNLS, UnicodeEncoding, UTF32Encoding, // UTF7Encoding, and UTF8Encoding. // The reason the code is separated out into a static class, rather // than a base class which overrides all of these methods for us // (which is what EncodingNLS is for internal Encodings) is because // that's really more of an implementation detail so it's internal. // At the same time, C# doesn't allow a public class subclassing an // internal/private one, so we end up having to re-override these // methods in all of the public Encodings + EncodingNLS. // Returns the number of bytes required to encode a range of characters in // a character array. public override int GetByteCount(char[] chars, int index, int count) { return(EncodingForwarder.GetByteCount(this, chars, index, count)); }
public override int GetByteCount(String s) { return(EncodingForwarder.GetByteCount(this, s)); }
public override int GetByteCount(string chars) { return(EncodingForwarder.GetByteCount(this, chars)); }