Let's say i have a class that is derived from PropertyDescriptor
why would something like the following return an undefined value or need to be cast
in the first place since MyProp "is a" PropertyDescriptor and PropertyDescriptorCollections contains a collection of PropertyDescriptors
if MyProp is a PropertyDescriptor how can this be happening. Any help would be greatly appreciated.
Code:
public class MyProp : PropertyDescriptor
{
//implement all abstract methods
}
why would something like the following return an undefined value or need to be cast
in the first place since MyProp "is a" PropertyDescriptor and PropertyDescriptorCollections contains a collection of PropertyDescriptors
Code:
public class SomeClass
{
private int id=0;
private string customer="";
public SomeClass()
{
foreach(PropertyDescriptor p in TypeDescriptor.GetProperties(this.GetType()))
{
//MyProp mP = p;//this won't compile type conversion
MyProp mP = p;//mp is undefined
PropertyDescriptor prD = p//this works
}
}
public int ID{get{return id;}set{id=value;}}
public string Customer{get{return customer;}set{customer=value;}}
}
if MyProp is a PropertyDescriptor how can this be happening. Any help would be greatly appreciated.