IronPython.Modules.MemoryHolder.ReadUnicodeString C# (CSharp) Method

ReadUnicodeString() private method

private ReadUnicodeString ( int offset ) : string
offset int
return string
        internal string ReadUnicodeString(int offset) {
            try {
                return Marshal.PtrToStringUni(_data.Add(offset));
            } finally {
                GC.KeepAlive(this);
            }
        }

Same methods

MemoryHolder::ReadUnicodeString ( int offset, int length ) : string

Usage Example

Ejemplo n.º 1
0
            object INativeType.GetValue(MemoryHolder owner, object readingFrom, int offset, bool raw)
            {
                if (IsStringType)
                {
                    SimpleType st = (SimpleType)_type;
                    string     str;
                    if (st._type == SimpleTypeKind.Char)
                    {
                        str = owner.ReadAnsiString(offset, _length);
                    }
                    else
                    {
                        str = owner.ReadUnicodeString(offset, _length);
                    }

                    // remove any trailing nulls
                    for (int i = 0; i < str.Length; i++)
                    {
                        if (str[i] == '\x00')
                        {
                            return(str.Substring(0, i));
                        }
                    }

                    return(str);
                }

                _Array arr = (_Array)CreateInstance(Context.SharedContext);

                arr._memHolder = new MemoryHolder(owner.UnsafeAddress.Add(offset), ((INativeType)this).Size, owner);
                return(arr);
            }
All Usage Examples Of IronPython.Modules.MemoryHolder::ReadUnicodeString