Mono.Debugger.Languages.Mono.MonoStringType.CreateObject C# (CSharp) Method

CreateObject() public method

public CreateObject ( object obj ) : byte[]
obj object
return byte[]
        public override byte[] CreateObject(object obj)
        {
            string str = obj as string;
                        if (str == null)
                                throw new ArgumentException ();

                        char[] carray = ((string) obj).ToCharArray ();
                        byte[] retval = new byte [carray.Length * 2];

                        for (int i = 0; i < carray.Length; i++) {
                                retval [2*i] = (byte) (carray [i] & 0x00ff);
                                retval [2*i+1] = (byte) (carray [i] >> 8);
                        }

                        return retval;
        }