Join Ted Neward for an in-depth discussion in this video Accessing properties, part of CLR Reflection for Developers.
- [Instructor] So in order to access…properties reflectively, well basically it's going to…be the same type of exercise that we were…just talking about.…We're going to get ahold of a PropertyInfo,…referencing the property or properties in question…that we're interested in, and again,…make use of the BindingFlags here,…particularly if you want to get ahold of instance…versus static, that will definitely make a difference.…But then from there, assuming this property supports…the idea of being able to do a read,…that is to say, if the PropertyInfo dot can read…returns true, we can use the GetValue method…on the property info in order to obtain…the value of a property for a particular instance.…
So we are actually, again, because PropertyInfo…is not attached to any particular object,…we are going to have to pass the instance…of the object who's property we want to read…in to the GetValue method.…Now if this is a static property,…that is to say if we're looking at the origin property…on the point class, there is no instance…
- Working with the IL Disassembler (Ildasm)
- Namespaces and types
- Type API
- Properties API
- MethodBase and MethodInfo API
- Constructors API
- Fields API
- Constructing objects
- Accessing properties and fields
- Invoking methods
Skill Level Intermediate
Deploying .NET Applications with Octopus Deploywith Floyd Hilton1h 27m Intermediate
2. IL Disassembler (Ildasm)
3. Reflection Namespace and Types
4. Type API
5. Properties API
6. MethodBase and MethodInfo API
7. Constructors API
Constructors API demo2m 52s
8. Fields API
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.