I want to inherit to extend the C# string class to add methods like WordCount() and several many others but I keep getting this error:
Error 1 ‘WindowsFormsApplication2.myString’: cannot derive from sealed
type ‘string’
Is there any other way I can get past this ? I tried with string and String but it didn’t work.
System.String is sealed, so, no, you can’t do that.
You can create extension methods. For instance,
use: