Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
GeneralRe: Use a maked textbox to limit entry to some char Pin
#realJSOP5-May-08 11:03
mve#realJSOP5-May-08 11:03 
GeneralRe: Use a maked textbox to limit entry to some char Pin
baranils5-May-08 19:14
baranils5-May-08 19:14 
AnswerRe: Use a maked textbox to limit entry to some char Pin
Christian Graus5-May-08 18:08
protectorChristian Graus5-May-08 18:08 
GeneralRe: Use a maked textbox to limit entry to some char Pin
#realJSOP6-May-08 3:30
mve#realJSOP6-May-08 3:30 
QuestionHow to traverse class properties for Nunit tests? Pin
pankazmittal5-May-08 6:47
pankazmittal5-May-08 6:47 
AnswerRe: How to traverse class properties for Nunit tests? Pin
Gareth H5-May-08 7:36
Gareth H5-May-08 7:36 
AnswerRe: How to traverse class properties for Nunit tests? Pin
Brady Kelly5-May-08 8:37
Brady Kelly5-May-08 8:37 
AnswerRe: How to traverse class properties for Nunit tests? Pin
Ed.Poore5-May-08 12:02
Ed.Poore5-May-08 12:02 
Using LINQ because it's so much easier... Cool | :cool:

1) How to know names of public properties of classes in .NET dynamically?
var properties = yourType.GetProperties().Select(p => p.Name); // Returns an IEnumerable<string> of the names (only returns public by default)
2) Property types
var properties = yourType.GetProperties().Select(p => p.PropertyType); // Returns IEnumerable<Type> of property type
var instance = Activator.CreateInstance(properties.First());           // Creates the default value for the type of the first property in list
3) Nested classes
var childClasses = typeof(Program).GetNestedTypes().Select(t => t.Name);  // Returns IEnumerable<string> of names of child properties

Note you can retrieve these without LINQ just forget the .Select(...) pattern, but you asked for names which implies strings so I used LINQ to extract the names rather than a loop.



QuestionLoadPostData Error Pin
ceetee5-May-08 5:53
ceetee5-May-08 5:53 
AnswerRe: LoadPostData Error Pin
Gareth H5-May-08 6:21
Gareth H5-May-08 6:21 
GeneralRe: LoadPostData Error Pin
ceetee5-May-08 7:12
ceetee5-May-08 7:12 
Questiondisable taskmanager Pin
False Chicken5-May-08 5:03
False Chicken5-May-08 5:03 
AnswerRe: disable taskmanager Pin
tgrt5-May-08 5:42
tgrt5-May-08 5:42 
AnswerRe: disable taskmanager Pin
Dave Kreskowiak5-May-08 6:48
mveDave Kreskowiak5-May-08 6:48 
AnswerRe: disable taskmanager Pin
Giorgi Dalakishvili5-May-08 8:07
mentorGiorgi Dalakishvili5-May-08 8:07 
AnswerRe: disable taskmanager Pin
PIEBALDconsult5-May-08 8:44
mvePIEBALDconsult5-May-08 8:44 
QuestionAdd login form to a program? Pin
daden2035-May-08 4:48
daden2035-May-08 4:48 
AnswerRe: Add login form to a program? Pin
carbon_golem5-May-08 6:51
carbon_golem5-May-08 6:51 
Questionhow I know that which property is associated which file at run time. Pin
Guru Call5-May-08 4:47
Guru Call5-May-08 4:47 
QuestionRunning a form in a diferent Thread Pin
oscarderooij5-May-08 4:07
oscarderooij5-May-08 4:07 
AnswerRe: Running a form in a diferent Thread Pin
S. Senthil Kumar5-May-08 5:34
S. Senthil Kumar5-May-08 5:34 
GeneralRe: Running a form in a diferent Thread Pin
oscarderooij6-May-08 2:29
oscarderooij6-May-08 2:29 
GeneralRe: Running a form in a diferent Thread Pin
S. Senthil Kumar6-May-08 2:54
S. Senthil Kumar6-May-08 2:54 
GeneralRe: Running a form in a diferent Thread Pin
oscarderooij13-May-08 3:27
oscarderooij13-May-08 3:27 
AnswerRe: Running a form in a diferent Thread Pin
Luc Pattyn5-May-08 7:19
sitebuilderLuc Pattyn5-May-08 7:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.