4
455
Hello.
I'm quite new to C# and am wondering which things I need to clean up when my
code completes, if any at all.
For example...
Assembly a = Assembly.Load(ServiceName);
Type mm = a.GetType(AssemblyName);
object o = Activator.CreateInstance(mm);
bject [] par = new object[] {xDoc};
string sReturn = "";
sReturn = (String) mm.InvokeMember("Execute",BindingFlags.Default |
BindingFlags.InvokeMethod,null,o,par);
//TODO: Do I need to dispose these things?
//((IDisposable)mm).Dispose();
mm = null;
a = null;
o = null;
par = null;
Is this the right way to do it? Or do I use my (IDisposable)x.Dispose()?
And if so, what is it doing?
I'm quite new to C# and am wondering which things I need to clean up when my
code completes, if any at all.
For example...
Assembly a = Assembly.Load(ServiceName);
Type mm = a.GetType(AssemblyName);
object o = Activator.CreateInstance(mm);
bject [] par = new object[] {xDoc};
string sReturn = "";
sReturn = (String) mm.InvokeMember("Execute",BindingFlags.Default |
BindingFlags.InvokeMethod,null,o,par);
//TODO: Do I need to dispose these things?
//((IDisposable)mm).Dispose();
mm = null;
a = null;
o = null;
par = null;
Is this the right way to do it? Or do I use my (IDisposable)x.Dispose()?
And if so, what is it doing?