Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在非静态类中有一个静态方法。我想在这个静态方法中使用这个关键字。或者是否有其他类似的实现。
没有办法this在静态方法中使用。您必须使用类名来引用静态方法中的静态成员(例如ClassName.StaticField)。用 引用的实例成员this在静态方法中不可用。
this
ClassName.StaticField