Click here to Skip to main content
16,017,881 members
Home / Discussions / C#
   

C#

 
AnswerRe: Problem with Log4Net with NHibernate Pin
led mike24-Jul-07 9:30
led mike24-Jul-07 9:30 
GeneralRe: Problem with Log4Net with NHibernate [modified] Pin
Iftekhar Naim24-Jul-07 19:31
Iftekhar Naim24-Jul-07 19:31 
GeneralGenerics and Constraints Pin
J$24-Jul-07 6:41
J$24-Jul-07 6:41 
GeneralRe: Generics and Constraints Pin
MidwestLimey24-Jul-07 8:39
professionalMidwestLimey24-Jul-07 8:39 
GeneralRe: Generics and Constraints Pin
J$24-Jul-07 8:56
J$24-Jul-07 8:56 
GeneralRe: Generics and Constraints Pin
led mike24-Jul-07 9:47
led mike24-Jul-07 9:47 
GeneralRe: Generics and Constraints Pin
J$24-Jul-07 10:38
J$24-Jul-07 10:38 
GeneralRe: Generics and Constraints Pin
Pete O'Hanlon24-Jul-07 10:18
mvePete O'Hanlon24-Jul-07 10:18 
Unfortunately, as you've found out, the new constraint only states that the constrained object must implement the default parameterless constructor. When you think about it, you can see why it behaves the way that it does. Obviously, having a specific constraint on a constructor would mean that you would be constraining it to a particular type and this type may end up being orthoganal to your generic type.

Of course, you could simulate this by doing the following:
public class MyClass<T, U> where T : new() where U : MyConstrainedClass
{
  public MyClass(U item)
  {
  }
}
It's not exactly a neat solution, but it may go someway towards what you are trying to achieve.

Deja View - the feeling that you've seen this post before.

QuestionMessage Queue Error Pin
ramdil24-Jul-07 6:26
ramdil24-Jul-07 6:26 
QuestionNew Ideas For graduation Project Pin
monafr8124-Jul-07 6:08
monafr8124-Jul-07 6:08 
AnswerRe: New Ideas For graduation Project Pin
Paul Conrad24-Jul-07 6:22
professionalPaul Conrad24-Jul-07 6:22 
JokeRe: New Ideas For graduation Project Pin
Not Active24-Jul-07 7:48
mentorNot Active24-Jul-07 7:48 
AnswerRe: New Ideas For graduation Project Pin
dino209424-Jul-07 8:03
dino209424-Jul-07 8:03 
JokeRe: New Ideas For graduation Project Pin
BoneSoft24-Jul-07 10:46
BoneSoft24-Jul-07 10:46 
Questionevent , delegate , publish Pin
cleverhouse24-Jul-07 5:56
cleverhouse24-Jul-07 5:56 
AnswerRe: event , delegate , publish Pin
ramdil24-Jul-07 6:31
ramdil24-Jul-07 6:31 
GeneralRe: event , delegate , publish Pin
cleverhouse24-Jul-07 6:44
cleverhouse24-Jul-07 6:44 
AnswerRe: event , delegate , publish Pin
led mike24-Jul-07 9:42
led mike24-Jul-07 9:42 
AnswerRe: event , delegate , publish Pin
BoneSoft24-Jul-07 10:44
BoneSoft24-Jul-07 10:44 
QuestionUsing a USB Joystick in C# Pin
Yeates24-Jul-07 5:41
Yeates24-Jul-07 5:41 
AnswerRe: Using a USB Joystick in C# Pin
Member 1678927-Oct-13 1:48
professionalMember 1678927-Oct-13 1:48 
QuestionCOM interop question Pin
mhp13024-Jul-07 5:21
mhp13024-Jul-07 5:21 
AnswerRe: COM interop question Pin
originSH24-Jul-07 6:27
originSH24-Jul-07 6:27 
GeneralRe: COM interop question Pin
mhp13024-Jul-07 7:05
mhp13024-Jul-07 7:05 
QuestionHelpProvider Pin
RussBus24-Jul-07 4:52
RussBus24-Jul-07 4:52 

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.