An easier solution otherwise is to use the debug symbol if you have
them. Make sure you read the symbols:

Jb a puppy was just killed for this suggestion :)



On Monday, November 3, 2014, Jb Evain <[email protected]> wrote:

> If you only have the assembly, and if you parse the solution with
> Roslyn, you can find the TypeDeclarationSyntax for which there's a
> DeclaredSymbol matching the fullname of your type.
>
> An easier solution otherwise is to use the debug symbol if you have
> them. Make sure you read the symbols:
>
> https://github.com/jbevain/cecil/wiki/Debug-symbols
>
> And then, some instructions in your type's methods will have a
> SequencePoint mapping to a point in a document with a filename.
>
> You can then parse this file.
>
> Warning, some types are defined in multiple files. Some methods even
> have a body spread accross multiple files.
>
> Jb
>
> On Mon, Nov 3, 2014 at 1:21 PM, vexe <[email protected] <javascript:;>>
> wrote:
> > Thanks both for your replies.
> >
> > GetMembers/GetFields do seem to return fields in their original order,
> but
> > in my case I also have properties, GetMembers then yields different
> results.
> > For ex replacing the Transform t to Transform t { get; set; } and doing
> > typeof(MyType).GetMembers().Foreach(Console.WriteLine) showed the
> property
> > at the top, and then the fields, at least on my machine. So it seems I
> need
> > the source approach.
> >
> > Do you happen to know of any reliable way to get the source code of a
> class?
> > Only way I can think of is, given a Type I search the project's files
> for a
> > match against the Type's name, which implies that the type name must
> match
> > its file. Ideas?
> >
> > Cheers!
> >
> > --
> > --
> > --
> > 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] <javascript:;>.
> > 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] <javascript:;>.
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Studying for the Turing test

-- 
-- 
--
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.

Reply via email to