Click here to Skip to main content
16,021,125 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
How to know properties of classes using generic in C#
Posted
Comments
OriginalGriff 1-Jun-12 3:51am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, read your homework instructions, or read your mind.
Use the "Improve question" widget to edit your question and provide better information.
Manfred Rudolf Bihy 1-Jun-12 5:22am    
Seems to me OP is most likely trying to look into "Generic Type Constraints".
Maybe a wild guess, but it's what came first to mind when I read the question.
OriginalGriff 1-Jun-12 5:38am    
Could be - but it'd be nice to be sure!
pataoengineer 1-Jun-12 4:22am    
The question looks absolutely unclear.
We don't even realize what was exactly what you have doubted.
Manfred Rudolf Bihy 1-Jun-12 5:24am    
Looks to me as if OP wants to know about "generic type constraints".

1 solution

In the definition of a generic type[^] you can use the where[^] keyword[^] to add a generic type constraint[^].
Generic type constraints are a neat way to enforce that a reference type or value type can only be used in the definition of a variable in conjunction with the generic type if it satisfies the exact requisites that were specified in the type constraint(s).

If you still have doubts after reading the documentation found on Constraints on Type Parameters (C# Programming Guide)[^] feel free to come back and leave me a comment.

Regards,

Manfred
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900