你如何在vb.net中继承StringBuilder?

And*_*ers 6 vb.net stringbuilder

我想将自己的成员添加到StringBuilder类中,但是当我去创建它时,IntelliSense并没有提起它.

public class myStringBuilder()
    Inherits System.Text.[StringBuilder should be here]
    ....
end class
Run Code Online (Sandbox Code Playgroud)

它甚至可能吗?谢谢

Jef*_*tes 16

StringBuilderNotInheritable(也就是sealed在C#中),所以你无法从中得到它.您可以尝试StringBuilder在自己的类中包装或考虑使用扩展方法.