public string Get(Encoding encoding) { this.ValidatePointer(nameof(Get)); int stringBufferSize = this.GetStringBufferSize(encoding); XDRPCStringArgumentInfo stringArgumentInfo = new XDRPCStringArgumentInfo(string.Empty, encoding, ArgumentType.Out, stringBufferSize, CountType.Byte); this.Get((XDRPCArgumentInfo)stringArgumentInfo); return(stringArgumentInfo.Value); }
public XDRPCStringArgumentInfo(string v, Encoding encoding, ArgumentType t, int cchMax) : this(v, encoding, t, cchMax, XDRPCStringArgumentInfo.GetDefaultCountTypeForEncoding(encoding)) { }
internal static XDRPCArgumentInfo GenerateArgumentInfo( Type t, object o, ArgumentType at, int size, Encoding encoding) { XDRPCArgumentInfo xdrpcArgumentInfo = (XDRPCArgumentInfo)null; if (t.IsPrimitive || t.IsValueType) { Type type; if (t.IsPrimitive) { type = typeof(XDRPCArgumentInfo <>).MakeGenericType(t); } else { type = typeof(XDRPCStructArgumentInfo <>).MakeGenericType(t); } xdrpcArgumentInfo = (XDRPCArgumentInfo)type.GetConstructor(new Type[2] { t, typeof(ArgumentType) }).Invoke(new object[2] { o, (object)at }); } else if (XDRPCMarshaler.IsValidArrayType(t)) { xdrpcArgumentInfo = (XDRPCArgumentInfo)typeof(XDRPCArrayArgumentInfo <>).MakeGenericType(t).GetConstructor(new Type[3] { t, typeof(ArgumentType), typeof(int) }).Invoke(new object[3] { o, (object)at, (object)size }); } else if (typeof(string) == t) { xdrpcArgumentInfo = (XDRPCArgumentInfo) new XDRPCStringArgumentInfo((string)o, encoding, at, size, XDRPCStringArgumentInfo.GetDefaultCountTypeForEncoding(encoding)); } return(xdrpcArgumentInfo); }