Fixed fields in .NET are very special. The fixed field that you have ( public fixed byte foo[10]) is compiled into a special nested structure, and the type of the fixed field changes to this nested structure. In short, this is:
public fixed byte foo[10];
It turns out compiled into this:
[CompilerGenerated, UnsafeValueType]
[StructLayout(LayoutKind.Sequential, Size = 10)]
public struct <foo>e__FixedBuffer0
{
public byte FixedElementField;
}
[FixedBuffer(typeof(byte), 10)]
public <foo>e__FixedBuffer0 foo;
, ILSpy.
, # GetString(obj.foo), :
GetString(&obj.foo.FixedElementField);
, ( , GetString , byte*).
IronPython, - : <foo>e__FixedBuffer0, byte* (). , , #, - FixedElementField GetString, , , Python ( ) & #.
: IronPython. , "":
public string GetFooString(Baz baz)
{
return new string((sbyte*)baz.foo);
}
PS IronPython, , , - foo prop, , .