So I want to open dynamic class as something like that :
using System ...
...
using System.Windows.Forms;
using core = new myNamespace.myClass(); // Sure it doesn't work but how to realize it ?
when I do
using myNamespace.myClass(); I can't use it because myClass is dynamic but I want it creates as this class creates and being dispose with it. And I want to have access varables / methods of myClass aslike as from this class, like
core.X must be as same as X.
probably I just want something like Interface, but as a class.
Ok I will try to explain exactly what I want to get :
for example I've got partial classes, and each one with 2 files ! and ... the content of second file is the same. How do I use one file for all partial classes ? like a module but without prefix !
so I know my English isn't perfect , I will add a code example :
public partial class FRIIB : Form
{
private string x = username;
}
public partial class FRIIB : Form
{
private string username = "hi";
}
public partial class LOLO : Form
{
private string x = username;
// I don't want to create another file with "username" definition
}
I was thinking about using Mixin ... it's looking like exactly what I want to get.
a using
statement needs to be within the context/scope of a single method.
If you can't constrain the scope to a method, you'll need to dispose it manually, usually be implementing IDisposable
on an object, and doing the dispose in Dispose()
. Sometimes (but very rarely) you might also want a finalizer to catch undisposed objects as the get collected - but emphasis: very rare.
There is no inbuilt mechanism for disposing static fields - you'd have to add a static Release()
method (or similar) to call during clean app-exit.
There is also a using
alias which looks a bit like your code, but does something completely unrelated (it allows you to use an alternative name for a single type, either for convenience or to avoid ambiguity; it is limited to the single file).