Is something like that possible?
Let's say I have the String Class. And I want to add a Method DoStringCalc()
. Now I want one Class which holds all these special strings and calls DoStringCalc()
on all of them. But every String can have a different logic in DoStringCalc()
and there can be thousands of them.
Most logical for me (coming from java) would be to override the Method DoStringCalc()
when initializing a new String. e.g:
String hello = new String() {
public override DoStringCalc() {
//do something here
}
}
How is this solved in C#?