Does it look something like:
FieldDefinition backingField = new
FieldDefinition(string.Format("__{0}_backingField", propertyName),
propertyType, Mono.Cecil.FieldAttributes.Private);
typeDef.Fields.Add(backingField);
if (typeDef.GenericParameters.Count > 0)
{
GenericInstanceType declaringType = new
GenericInstanceType(typeDef);
foreach (GenericParameter parameter in
typeDef.GenericParameters)
{
declaringType.GenericArguments.Add(parameter);
}
backingField.DeclaringType = declaringType;
}
..?
On Jan 5, 4:45 pm, "Jb Evain" <[EMAIL PROTECTED]> wrote:
> Hey,
>
> On 1/5/08, Philip_L <[EMAIL PROTECTED]> wrote:
>
> > More importantly, which overload of the CilWorker class allows me to
> > emit an Ldfld with a MemberReference? No such overload exists...
>
> MemberReference is abstract, so you would not be able to create one anyway :)
>
> But in your case, what you want to do is to create a FieldReference,
> with the approriate declaring type.
>
> Looking at your code, the declaring type should be a
> GenericInstanceType, with a GenericArgument being the GenericParameter
> of the type Sample`1.
>
> Generics are convoluted :)
>
> --
> Jb Evain <[EMAIL PROTECTED]>
--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---