Hi Jb,

On Tue, Aug 17, 2010 at 3:52 PM, Jb Evain <[email protected]> wrote:

> Hey,
>
> On Tue, Aug 17, 2010 at 12:20 PM, Knight Commander
> <[email protected]> wrote:
> > Is FieldDefinition.InitialValue what should appear in ".data" section? I
> > created a type which contains a byte[] field with a large initialValue
> but
> > there is no sign of ".data" in output of ildasm but the assembly binary
> > image contains the initialvalue content.
>
> Weird. Do you have a small snippet of code reproducing the issue?
>
>
Here it is the code:

*AssemblyDefinition* assm =
        *AssemblyDefinition*.*CreateAssembly*(new
AssemblyNameDefinition("myassem", new
        Version("1.0.0.0")), "mainmodule", ModuleKind.Dll);
*TypeDefinition* type = new *TypeDefinition*("ghoori", "chai",
TypeAttributes.Class);
*ModuleDefinition* mod = assm.*Modules*[0];
mod.Types.Add(type);
*FieldDefinition* fild = new *FieldDefinition*("initdar",
FieldAttributes.Private, mod.Import(typeof (byte[])));

type.*Fields*.*Add*(fild);
fild.*InitialValue* = new byte[] {65, 65, 65, 65, 65, 65, 65, 65, 65, 65};
// will appear as a sequence of 'A' in binary view of output file.
assm.*Write*("ass.dll");


> --
> Jb Evain  <[email protected]>
>
> --
> --
> mono-cecil

-- 
--
mono-cecil

Reply via email to