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
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/
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
- 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
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) :
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
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
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
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 _
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
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
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
12 matches
Mail list logo