A good and complete tutorial about reflection in .

2020-02-09 02:05发布

问题:


Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 6 years ago.

the question almost says it all. I think all of you know about the visual studio designer, and how it can show any property of an object, regardless of its type, provided that the property is allowed to be shown in the designer.

I am working on a function that could achieve the same thing, but for this, I need a complete tutorial about reflection, so that this function can treat every type of property.

Any suggestions?

回答1:

Here are some good links :

  • http://csharp.net-tutorials.com/reflection/introduction/
  • http://www.codeproject.com/Articles/17269/Reflection-in-C-Tutorial
  • http://www.codeguru.com/csharp/csharp/cs_misc/reflection/article.php/c4257
  • http://www.youtube.com/watch?v=C-G7fobbBP0


回答2:

Here some info:

  • http://www.codeproject.com/Articles/55710/Reflection-in-NET
  • CLR via C# by Jeffrey Richter has a good chapter on Reflection

However, I'd recommend a bit different although harder approach. If you really want to completely understand the topic, that's what you need.

Read Standard ECMA-335 Partition II: Metadata Definition and Semantics which explains how .NET uses its metadata

Then read and understand some code that reads this metadata. Mono.Cecil would be a good candidate.

That will completely cover the Reflection topic