Click here to Skip to main content
15,885,939 members
Home / Discussions / C#
   

C#

 
GeneralRe: The irony Pin
Luc Pattyn11-Aug-10 10:17
sitebuilderLuc Pattyn11-Aug-10 10:17 
AnswerRe: StringBuilder vs += on string Pin
AspDotNetDev11-Aug-10 9:22
protectorAspDotNetDev11-Aug-10 9:22 
QuestionMultiple report system Pin
Neo Maximus11-Aug-10 4:14
Neo Maximus11-Aug-10 4:14 
AnswerRe: Multiple report system Pin
Chris Trelawny-Ross11-Aug-10 8:19
Chris Trelawny-Ross11-Aug-10 8:19 
QuestionSystem.Globalization.CultureInfo [modified] Pin
ONeil Tomlinson11-Aug-10 3:55
ONeil Tomlinson11-Aug-10 3:55 
AnswerRe: System.Globalization.CultureInfo Pin
Dewald11-Aug-10 4:09
Dewald11-Aug-10 4:09 
AnswerRe: System.Globalization.CultureInfo Pin
Ian Shlasko11-Aug-10 4:09
Ian Shlasko11-Aug-10 4:09 
QuestionConstraints taking either types in generics Pin
dashingsidds11-Aug-10 3:34
dashingsidds11-Aug-10 3:34 
Hi Experts,

In generics we can give constraints using the "where" clause like

public void MyGeneric <T>() where T : MyClass1 {...}


Now if i want the type T to be of type MyClass1 and say an interface IMyInterface then i need to do something like

public void MyGeneric <T>() where T : MyClass1, IMyInterface  {...}


But I dont know (or maybe it is not possible) if we can create a generic method that can take types which inherits from either of the 2 types. i.e. if any of my other classes inherits from MyClass1 or implements IMyInterface but neither of my class has both then my generic method should work for these classes.

I hope I have been clear.

Please help!
Thanks in advance!

Regards,

Samar
AnswerRe: Constraints taking either types in generics Pin
Ennis Ray Lynch, Jr.11-Aug-10 3:52
Ennis Ray Lynch, Jr.11-Aug-10 3:52 
AnswerRe: Constraints taking either types in generics Pin
kapax511-Aug-10 3:52
kapax511-Aug-10 3:52 
GeneralRe: Constraints taking either types in generics Pin
dashingsidds11-Aug-10 4:00
dashingsidds11-Aug-10 4:00 
GeneralRe: Constraints taking either types in generics Pin
Luc Pattyn11-Aug-10 4:14
sitebuilderLuc Pattyn11-Aug-10 4:14 
GeneralRe: Constraints taking either types in generics Pin
kapax511-Aug-10 4:24
kapax511-Aug-10 4:24 
AnswerRe: Constraints taking either types in generics Pin
Łukasz Nowakowski11-Aug-10 4:00
Łukasz Nowakowski11-Aug-10 4:00 
AnswerRe: Constraints taking either types in generics Pin
Covean11-Aug-10 5:49
Covean11-Aug-10 5:49 
GeneralRe: Constraints taking either types in generics Pin
PIEBALDconsult11-Aug-10 16:45
mvePIEBALDconsult11-Aug-10 16:45 
GeneralRe: Constraints taking either types in generics Pin
Covean11-Aug-10 22:31
Covean11-Aug-10 22:31 
AnswerRe: Constraints taking either types in generics Pin
PIEBALDconsult11-Aug-10 16:37
mvePIEBALDconsult11-Aug-10 16:37 
Questionsql express installing when I call it from my program, but does not work!! Pin
lourensG11-Aug-10 3:04
lourensG11-Aug-10 3:04 
AnswerRe: sql express installing when I call it from my program, but does not work!! Pin
PIEBALDconsult11-Aug-10 3:07
mvePIEBALDconsult11-Aug-10 3:07 
GeneralRe: sql express installing when I call it from my program, but does not work!! [modified] Pin
lourensG11-Aug-10 3:15
lourensG11-Aug-10 3:15 
GeneralRe: sql express installing when I call it from my program, but does not work!! Pin
Dave Kreskowiak11-Aug-10 5:56
mveDave Kreskowiak11-Aug-10 5:56 
GeneralRe: sql express installing when I call it from my program, but does not work!! Pin
lourensG11-Aug-10 20:54
lourensG11-Aug-10 20:54 
GeneralRe: sql express installing when I call it from my program, but does not work!! Pin
Dave Kreskowiak12-Aug-10 2:11
mveDave Kreskowiak12-Aug-10 2:11 
Questionarray to array copy Pin
varsh1211-Aug-10 0:12
varsh1211-Aug-10 0:12 

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.