Skip to content

Instantly share code, notes, and snippets.

@gshutler
Created April 7, 2010 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gshutler/359105 to your computer and use it in GitHub Desktop.
Save gshutler/359105 to your computer and use it in GitHub Desktop.
class Encrypted<T>
{
readonly byte[] value;
T decrypted;
public Encrypted(byte[] value)
{
this.value = value;
}
public T Value
{
get
{
if (ReferenceEquals(decrypted, default(T)))
{
decrypted = DecryptValue();
}
return decrypted;
}
}
static T DecryptValue()
{
return default(T);
}
public static implicit operator T(Encrypted<T> value)
{
return value.Value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment