Join Ted Neward for an in-depth discussion in this video Accessing fields, part of CLR Reflection for Developers.
- [Instructor] Now, one of the things…that Reflection will allow us to do,…if we can access properties, if we can invoke methods,…if we can call constructors, it would seem natural…that we should also be able to access fields,…and most certainly Reflection will allow us to do that.…Again, same pattern.…Get ahold of a FieldInfo for that particular field.…And then we can use similar to what we see…with the property info objects,…we can use the GetValue method…to obtain the value of that field,…or the SetValue method to modify the value of that field.…And this is actually what most people find most surprising…about the reflective access, is this will actually allow us…to bypass the private access modifier on a field,…assuming the CLR allows it in terms of security procedures,…which it does by default.…
That's its default security setting.…So let's see how that works at runtime.…
- 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.