No, it’s not.
Objects don’t have names – variables do. An object may be referenced by any number of variables: zero, one or many.
What you can do, however, is get fields (static or instance variables) by name (using Type.GetField
) and get the values of those fields (for a specific instance, if you’re using instance variables).
Depending on what you’re trying to do, you might also want to consider a dictionary from names to objects.
Related Contents:
- How to get the list of properties of a class?
- How do I get the path of the assembly the code is in?
- Set object property using reflection
- How to create a new object instance from a Type
- Correct Way to Load Assembly, Find Class and Call Run() Method
- Find a private field with Reflection?
- How costly is .NET reflection?
- How to Load an Assembly to AppDomain with all references recursively?
- Testing if object is of generic type in C#
- How can I get all constants of a type by reflection?
- Get all derived types of a type
- How can I get all classes within a namespace?
- How to get a list of properties with a given attribute?
- How to determine if a type implements a specific generic interface type
- Read the value of an attribute of a method
- Purpose of Activator.CreateInstance with example?
- Mapping object to dictionary and vice versa
- How does WCF deserialization instantiate objects without calling a constructor?
- GetMethod for generic method [duplicate]
- How to call generic method with a given Type object? [duplicate]
- Use reflection to invoke an overridden base method
- Get a generic method without using GetMethods
- Reflection – Getting the generic arguments from a System.Type instance
- Convert.ChangeType() fails on Nullable Types
- Using Case/Switch and GetType to determine the object [duplicate]
- AddEventHandler using reflection
- Getting a System.Type from type’s partial name
- GetProperties() to return all properties for an interface inheritance hierarchy
- How can you get the names of method parameters?
- Using PropertyInfo to find out the property type
- Invoking methods with optional parameters through reflection
- Discovering derived types using reflection
- Is there a way to get a type’s alias through reflection?
- Resolve Type from Class Name in a Different Assembly
- Check if a property exists in a class
- Create object instance of a class from its name in string variable
- How to copy value from class X to class Y with the same property name in c#?
- Why do some C# lambda expressions compile to static methods?
- Why GetType returns System.Int32 instead of Nullable? [duplicate]
- Using GetProperties() with BindingFlags.DeclaredOnly in .NET Reflection
- Finding property differences between two C# objects
- Finding out if a type implements a generic interface
- How to get MethodInfo of interface method, having implementing MethodInfo of class method?
- How to find out if a property is an auto-implemented property with reflection?
- Get member to which attribute was applied from inside attribute constructor?
- How Can I add properties to a class on runtime in C#?
- Look if a method is called inside a method using reflection
- Why is the use of reflection in .NET recommended?
- Can I get parameter names/values procedurally from the currently executing function?
- Dynamically creating a proxy class