S
Steve Drake
Hello,
I may be mis understanding some of the uses of generics so this example may
not be valid, but here goes.
I have a method that I wont to be able to return a string or byte array, it
declared as :
public T Decrypt<T>(byte[] cipherText, byte[] optionalEntropy)
how do I know what type T is, I want todo something like :
if (T is string )
{
return (T)(object)Encoding.ASCII.GetString(plainText);
}
else
{
return (T)(object)plainText;
}
Also, I want to limit T to string or byte[], can this be done.
Steve
I may be mis understanding some of the uses of generics so this example may
not be valid, but here goes.
I have a method that I wont to be able to return a string or byte array, it
declared as :
public T Decrypt<T>(byte[] cipherText, byte[] optionalEntropy)
how do I know what type T is, I want todo something like :
if (T is string )
{
return (T)(object)Encoding.ASCII.GetString(plainText);
}
else
{
return (T)(object)plainText;
}
Also, I want to limit T to string or byte[], can this be done.
Steve