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.
我在 C++ 中有一个代码,基本上是一个类 const 和一个 dest
Abc(vector<std::string>& names); virtual ~Abc();
我需要知道 C# 中的等价物
谢谢
在 C# 中,你可以这样写:
Abc(List<string> names);
~Abc()并且在 C#中没有使用。它有垃圾收集器。
~Abc()
但是,如果您的类管理资源,则派生Abc并IDisposable实现Dispose()类似于以下内容的方法~Abc():
Abc
IDisposable
Dispose()
class Abc : IDisposable { Abc(ref List<string> names); void Dispose(); }