Hi
I have a class structor for example like this:
Person.name.fir stname()
Person.name.Las tname()
Person.Father.f irstname()
Person.Father.L astname()
Now I want to write a method for my class to return the firstnames like this:
Public function ReturnFirstname (methodname as string)
return (Person."method name".firstname )
end function
I dont know how...
Search Result
Collapse
8 results in 0.0020 seconds.
Keywords
Members
Tags
-
Access nested class methods by name as string
-
How to get property values in this situation
Hi
I got a question on how to get the property values using reflection in c#. (It's my first time to use, i think i lost somewhere...)
I have compile an assembly and successfully deserialize a XML to it.
By using 'InvokeMember' method, 'result' can hold the property of 'Deserializeobj ' (image enclosed : ref_Image1.jpg) . Then, i would like to ask how to further get all the values from the collection in... -
how can i evaluate generic type in runtime in c#
i need to evaluate generic type at runtime usingCode:Type.GetType()
Code:Type t = Type.GetType("className"); Table<t> table = dataContext.GetTable<t>();
-
How to dynamically set type
I'm populating object properties from a datatable and sometimes I will need to cast to a type that will not be known until runtime. I tried the following:
Code:foreach (DataRow r in dtIT.Rows) { foreach (PropertyInfo p in t.GetProperties()) { Type pType = p.GetType(); //assign any matching
-
Reflection, objects, and comparing types
Hi, I'm a vb.net developer getting the hang of c# and I've gotten stuck on trying to compare types. In the following block, I'm populating an object from a DataTable. The table's data types aren't always the right type so as I loop through I want to compare types and optionally try to convert to make the data match the object property types.
Code:Type t = _Item.GetType(); foreach (DataRow r
-
Access 'Interop.dsofile.dll' via reflection
Hi Everyone,
I am stuck to access file properties using 'Interop.dsofil e.dll'. I dont want registration of this assembly in system registry. I am using reflection to achive this, but at the time of create instance (Activator.Crea teInstance) of 'dsofile.OleDoc umentProperties Class' it throw the following registry exception:
"Retrieving the COM class factory for component with CLSID {58968145-CF05-4341-995F-2EE093F6ABA3}... -
Attributes and reflection of the type which they relate
Hi there,
I am currently working with the property grid and I am implementing an indexed category system (sorts categories via index before alphabetically) . I should say that at this point my current solution does work well, however it isn't the prettiest when it comes to specifying the attribute. Which at present looks either like:
[IndexedCategory (typeof(MyClass ), "General", 1)]
or
[IndexedCategory (typeof(MyClass ),... -
Reflecting generic collections of derived types
I am trying to use reflection in a property of a base type to inspect the properties of an instance of a type which is derived from that base type, when the properties can themselves be instances of types derived from that base type, or arrays or generic collections of instances of types derived from that base type.
All is well until I come to the properties which are generic collections, I don't seem to be able to find an elegant...