G
Guest
Hello!
I was wondering if there is a some way to mark a class property,
without modifiers use. By using reflection, I know how to get all properties
that returns int, but how to get only specific int properties?
See example below:
public class Test
{
private int _A;
private int _B;
public int A
{
get { return (_A); }
set { _A = value; }
}
(for example, I want to mark this property)
public int B
{
get { return (_B); }
set { _B = value; }
}
}
Object o = new Test();
PropertInfo[] properties = o.GetType().GetProperties();
I want to show only marked int properties? All these properties must be
accessible, so the way with modifiers public/protected is not useful.
I've done this with string array, so I have a condition inside loop that
checks if array contains a property. But I don't like doing it this way,
because I have a lot of classes and I think this is not the clearest way.
I will appreciate any suggestion.
Regards
Saso
I was wondering if there is a some way to mark a class property,
without modifiers use. By using reflection, I know how to get all properties
that returns int, but how to get only specific int properties?
See example below:
public class Test
{
private int _A;
private int _B;
public int A
{
get { return (_A); }
set { _A = value; }
}
(for example, I want to mark this property)
public int B
{
get { return (_B); }
set { _B = value; }
}
}
Object o = new Test();
PropertInfo[] properties = o.GetType().GetProperties();
I want to show only marked int properties? All these properties must be
accessible, so the way with modifiers public/protected is not useful.
I've done this with string array, so I have a condition inside loop that
checks if array contains a property. But I don't like doing it this way,
because I have a lot of classes and I think this is not the clearest way.
I will appreciate any suggestion.
Regards
Saso