c# - Is it possible to derive from System.String? -
this question has answer here:
- how can inherit string class? 7 answers
i deriving class string
. wont allow me inherit class:what need if want inherit this?
public class : string { //class definition }
you cannot inherit string
because sealed. if have extend provided functionality, have 2 options:
- write wrapper class around
string
, implement methods yourself. - use extension methods
Comments
Post a Comment