Hello Michael, The value of the field is going to be set in code in the constructor of the class, it's not represented on the FieldDefinition, except for constants.
Jb On Sat, Mar 3, 2018 at 6:05 AM, Michael Herman <[email protected]> wrote: > What I get back is the following... > > Type Fields... > Field Name: nextIndex > f.Fullname: System.Numerics.BigInteger NPC.dApps.NeoDraw. > NeoCounter::nextIndex > f.DeclaringType: NPC.dApps.NeoDraw.NeoCounter > f.FieldType: System.Numerics.BigInteger > f.IsPrivate: False > f.IsPublic: True > f.InitialValue.Length: 0 > f.HasConstant: False > f.HasDefault: False > f.InitialValue: System.Byte[] > f.InitialValue.Length: 0 > > > On Saturday, March 3, 2018 at 9:04:33 AM UTC-5, Michael Herman wrote: >> >> Hi, >> >> So far, I'm not getting too much love from the bold C# lines (see below) >> for the following class definition. I want to know when is an initial >> value for a field (e.g. 1234) and then dependent on the field type, get the >> actual value. >> >> using System.Numerics; >> >> >> namespace NPC.dApps.NeoDraw >> { >> public class NeoCounter: NPCLevel0Basic, >> NPCLevel1Managed, >> NPCLevel2Persistable, >> NPCLevel3Deletable, >> NPCLevel4Collectible >> { >> public BigInteger nextIndex = 1234; >> } >> } >> >> >> >> Mono-cecil code: >> >> foreach (FieldDefinition f in t.Fields) >> { >> if (Trace.Verbose) Console.WriteLine(" Field >> Name:\t" + f.Name); >> if (Trace.Verbose) Console.WriteLine(" >> f.Fullname:\t" + f.FullName); >> //if (Trace.Verbose) Console.WriteLine(" >> f.Module.FullyQualifiedName:\t" + f.Module.FullyQualifiedName); >> if (Trace.Verbose) Console.WriteLine(" >> f.DeclaringType:\t" + f.DeclaringType.ToString()); >> if (Trace.Verbose) Console.WriteLine(" >> f.FieldType:\t" + f.FieldType.ToString()); >> if (Trace.Verbose) Console.WriteLine(" >> f.IsPrivate:\t" + f.IsPrivate.ToString()); >> if (Trace.Verbose) Console.WriteLine(" >> f.IsPublic:\t" + f.IsPublic.ToString()); >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> * if (Trace.Verbose) Console.WriteLine(" >> f.HasConstant:\t" + f.HasConstant.ToString()); if >> (f.Constant != null) if (Trace.Verbose) Console.WriteLine(" >> f.Constant:\t" + f.Constant.ToString()); if >> (Trace.Verbose) Console.WriteLine(" f.HasDefault:\t" + >> f.HasDefault.ToString()); if (f.InitialValue != >> null) { if >> (Trace.Verbose) Console.WriteLine(" f.InitialValue:\t" + >> f.InitialValue.ToString()); if (Trace.Verbose) >> Console.WriteLine(" f.InitialValue.Length:\t" + >> f.InitialValue.Length.ToString()); if >> (f.InitialValue.Length > 0) { >> Int32 initialValue = BitConverter.ToInt32(f.InitialValue, 0); >> if (Trace.Verbose) Console.WriteLine(" >> f.InitialValue:\t" + initialValue.ToString()); >> } }* >> >> >> >> >> Best regards, >> Michael Herman (Toronto) >> > -- > -- > -- > mono-cecil > --- > You received this message because you are subscribed to the Google Groups > "mono-cecil" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- -- -- mono-cecil --- You received this message because you are subscribed to the Google Groups "mono-cecil" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
