Not sure if this is what you are looking for or not.
Reference for implicit conversion
http://msdn.microsoft.com/en-us/library/z5z9kes2.aspx[
^]
struct CustomString
{
private CustomString(string value)
{
_value = value;
}
private string _value = string.Empty;
public static implicit operator string(CustomString e)
{
return e._value;
}
public static implicit operator CustomString(string e)
{
return new CustomString(e);
}
}
class UseCustomString
{
CustomString e = "Some Text";
void Process()
{
if (e.Equals("Some Text"))
{
OtherProcess(e);
}
}
void OtherProcess(CustomString s)
{
}
}