Ok, in Perl causing an object to reinitialize itself is easy since it is represented by an assignable reference or pointer. C#, however, doesn't appear to like this.
I wanted to create a subclass of System.Text.RegularExpressions.Regex whose pattern could be changed without using new objects and consuming memory for each. (private initialize references wouldn't let me run it again so I tried recreating the object reference).
Is this possible to do without creating a full wrapper around the parent object with re-implementation of every method to point to a private regex object that is reinitialized for each new use? Is there a better way?
public class m_Regex : System.Text.RegularExpressions.Regex{
public m_Regex(string pattern): base (pattern){
}
public void Pattern(string pattern){
this = new m_Regex(pattern);
}
}