I want to extend a property to a class such as 'string class'.
e.g.:
public Color TextColor
{
get { ... }
set { ... }
}
string name="reza";
name.TextColor;
or
name.TextColor= Color.Red;
I want to extend a property to a class such as 'string class'.
e.g.:
public Color TextColor
{
get { ... }
set { ... }
}
string name="reza";
name.TextColor;
or
name.TextColor= Color.Red;
You cannot (at the time of writing) extend properties in c#, and you certainly cannot extend string
seeing as it is a sealed class.
Use methods instead of properties, and make a StringExtension
class instead of inheriting string.