Hey,
I'm attempting to use reflection in order to get the types of properties
in a class. However, I seem to be having trouble determining exactly which
type I am getting. In the foreach of running through the properties, the
PropertyInfo.Name does cycle through all the properties, however, if you
check the PropertyInfo.GetType().ToString() it is always
"System.Reflection.PropertyInfo". Which technically makes sense. What
doesnt make sense is that the PropertyInfo.GetType().IsEnum SEEMS to work
for each property.
So, my question is, how do I get the type of the property I am on?
Does this make sense?
- Roger 3 2202
PropertyInfo.PropertyType is what you're looking for.
Jose Solorzano
Roger Webb wrote: Hey,
I'm attempting to use reflection in order to get the types of
properties in a class. However, I seem to be having trouble determining exactly
which type I am getting. In the foreach of running through the properties,
the PropertyInfo.Name does cycle through all the properties, however, if
you check the PropertyInfo.GetType().ToString() it is always "System.Reflection.PropertyInfo". Which technically makes sense.
What doesnt make sense is that the PropertyInfo.GetType().IsEnum SEEMS to
work for each property.
So, my question is, how do I get the type of the property I am on?
Does this make sense?
- Roger
Thanks... That was it. I dont know why I was missing it.
- Roger
"Jose Solorzano" <jh******@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com... PropertyInfo.PropertyType is what you're looking for.
Jose Solorzano
Roger Webb wrote: Hey,
I'm attempting to use reflection in order to get the types of properties in a class. However, I seem to be having trouble determining exactly which type I am getting. In the foreach of running through the properties, the PropertyInfo.Name does cycle through all the properties, however, if you check the PropertyInfo.GetType().ToString() it is always "System.Reflection.PropertyInfo". Which technically makes sense. What doesnt make sense is that the PropertyInfo.GetType().IsEnum SEEMS to work for each property.
So, my question is, how do I get the type of the property I am on?
Does this make sense?
- Roger This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: UJ |
last post by:
Can somebody point me to an explanation of what Reflection is? I've tried
looking in the help and it's not very helpful.
TIA - Jeff.
|
by: Mike Malter |
last post by:
I am just starting to work with reflection and I want to create a log that saves relevant information if a method call fails so I
can call that method again later using reflection.
I am...
|
by: Pieter Breed |
last post by:
Hi All,
I am trying to use the attribute/reflection system to as much
potential as I can think of, but I've run into a snag. I would
appreciate it if someone would point me in the right...
|
by: System.Reflection Activator |
last post by:
**************************************
//Load the Assembly
Assembly a = Assembly.LoadFrom(sAssembly);
//Get Types so we can Identify the Interface.
Type mytypes = a.GetTypes();
BindingFlags...
|
by: Aaron Queenan |
last post by:
Given the classes:
class Class
{
public static implicit operator int(Class c)
{
return 0;
}
}
class Holder
|
by: HL |
last post by:
The requirement is to send some information to other objects. The objects to
whom the information has to be sent is not available at compile time. The
names of the types (objects) will be provided...
|
by: Luis Arvayo |
last post by:
Hi,
In c#, I need to dynamically create types at runtime that will consist of
the following:
- inherits from a given interface
- will have a constructor with an int argument
|
by: Rob |
last post by:
Hello,
I'm new to C# and have a question regarding factoring through
reflection.
I have a database filled with data represented by name and value pairs.
Each name has a identically named...
|
by: Erland |
last post by:
Hi,
I want to retreive different namespaces available within an Assembly
using Reflection. Is this possible? Can i retreive a namespace within
an Assembly using " Type " ?
My question is how...
|
by: raylopez99 |
last post by:
What good is C# Reflection, other than to find out what types are in
an assembly? And to dynamically invoke methods in an assembly (.dll
or .exe)?
Also, bonus question, can you use Reflection...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |