클래스가 두 개 있는데, 클래스 MyFirstClass
과 MyAnotherClass
, MyAnotherClass
이 IDiposable 인터페이스를 구현하고 있습니다.자식 개체를 삭제하거나 삭제하지 않습니까?
public class MyFirstClass
{
public string xyz{get;set;} ..... and so on
}
public class MyAnotherClass : IDisposable
{
private readonly MyFirstClass objFc = new MyFirstClass();
public static void MyStaticMethod()
{
var objOfFirstClass = new MyFirstClass();
// something with above object
}
public void MyNonStaticMethod()
{
// do something with objFc
}
#region Implementation of IDisposable
.... my implementations
#endregion
}
지금은 내가 MyAnotherClass
를 호출하고 한 번 더 클래스, 그래서 난 내 개체의 정리 시나리오에 대해 걱정한다 알고 싶습니다이
using(var anotherObj = new MyAnotherClass())
{
// call both static and non static methods here, just for sake of example.
// some pretty cool stuffs goes here... :)
}
같은이? 또한 내 ObjFC
(정적이 아닌 부분)과 objOfFirstClass
(정적 인 부분)은 어떻게됩니까?
AFAIK는 ...
'MyFirstClass'클래스는 'IDisposable'을 구현하지 않습니다. 이것은 의도에 의한 것인가? – Yogu
예 ... 이것은 의도 된 것입니다 ... –