Re: [ADVANCED-DOTNET] Store generic type as fields in class

2006-03-16 Thread RYoung
n - Original Message - From: "Stoyan Damov" <[EMAIL PROTECTED]> To: Sent: Thursday, March 16, 2006 3:45 PM Subject: Re: [ADVANCED-DOTNET] Store generic type as fields in class Ron, Hardcoding the serialization is not a good thing IMO. If this wrapper will only be used by y

Re: [ADVANCED-DOTNET] Store generic type as fields in class

2006-03-16 Thread Stoyan Damov
Ron, Hardcoding the serialization is not a good thing IMO. If this wrapper will only be used by you, that's probably OK, but if you intend to get the library out (w/ whatever license) it's not good, you need to provide some way for the library user to serialize his types (e.g. I may have a type w/

Re: [ADVANCED-DOTNET] Store generic type as fields in class

2006-03-16 Thread RYoung
I, convert it to byte[] - pass it to Parameter for deserialization to the managed type. Ron - Original Message - From: "Stoyan Damov" <[EMAIL PROTECTED]> To: Sent: Thursday, March 16, 2006 10:44 AM Subject: Re: [ADVANCED-DOTNET] Store generic type as fields in class JE

Re: [ADVANCED-DOTNET] Store generic type as fields in class

2006-03-16 Thread Stoyan Damov
- Original Message - > From: "Stoyan Damov" <[EMAIL PROTECTED]> > To: > Sent: Thursday, March 16, 2006 10:18 AM > Subject: Re: [ADVANCED-DOTNET] Store generic type as fields in class > > > This will also work: > > public void AddParameters(TKey

Re: [ADVANCED-DOTNET] Store generic type as fields in class

2006-03-16 Thread RYoung
for the prompt response. Ron - Original Message - From: "Stoyan Damov" <[EMAIL PROTECTED]> To: Sent: Thursday, March 16, 2006 10:18 AM Subject: Re: [ADVANCED-DOTNET] Store generic type as fields in class This will also work: public void AddParameters(TKey key, TData data) :

Re: [ADVANCED-DOTNET] Store generic type as fields in class

2006-03-16 Thread Stoyan Damov
r key, > BerkeleyParameter data) >{ >this.key = key; >this.data = data; >} >} > > Ron > - Original Message - > From: "J. Merrill" <[EMAIL PROTECTED]> > To: > Sent: Thursday, March 16, 2006 10:11 AM > Subject: Re: [ADV

Re: [ADVANCED-DOTNET] Store generic type as fields in class

2006-03-16 Thread RYoung
his.data = data; } } Ron - Original Message - From: "J. Merrill" <[EMAIL PROTECTED]> To: Sent: Thursday, March 16, 2006 10:11 AM Subject: Re: [ADVANCED-DOTNET] Store generic type as fields in class The compiler can't see the relationship between the and

Re: [ADVANCED-DOTNET] Store generic type as fields in class

2006-03-16 Thread Stoyan Damov
This will also work: public void AddParameters(TKey key, TData data) : where TKey : Key, TData : Data { this.key = new Parameter(key); this.data = new Parameter(data); } Haven't tried it, but it it works (and it should), you're not restricting the arguments and can have interfaces (or bas

Re: [ADVANCED-DOTNET] Store generic type as fields in class

2006-03-16 Thread RYoung
Excellent. Thanks for the solution. Ron - Original Message - From: "Ivanoff, Alex" <[EMAIL PROTECTED]> To: Sent: Thursday, March 16, 2006 9:56 AM Subject: Re: [ADVANCED-DOTNET] Store generic type as fields in class How about this: class Parameter { private T _

Re: [ADVANCED-DOTNET] Store generic type as fields in class

2006-03-16 Thread J. Merrill
The compiler can't see the relationship between the and (or and ), so it doesn't know that this.key is the same type as Parameter. If you change / to / (or vice versa) does it work? (Have not tried this.) BTW, "won't compile" is not as useful as quoting the message text and/or number. At

Re: [ADVANCED-DOTNET] Store generic type as fields in class

2006-03-16 Thread Ivanoff, Alex
data; } } -Original Message- From: Discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of RYoung Sent: Thursday, March 16, 2006 09:52 To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: [ADVANCED-DOTNET] Store generic type as fields in class I have this: class Para

[ADVANCED-DOTNET] Store generic type as fields in class

2006-03-16 Thread RYoung
I have this: class Parameter { private T _value; public Parameter( T t ) { _value = t; } } class Command { public void AddParameters(Parameter key, Parameter data) { ... }; } What I am trying to do is store the "key" and "data" arguments as fields in the Command class - ideall