KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm just curious to know that there is the (Name) property, which represents the name of the Form class. This property is used within the namespace to uniquely identify the class that the Form is an instance of and, in the case of Visual Basic, is used to access the default instance of the form. Now where this Default Instance come from, why can't C# have a equivalent method to this. Also for example to show a form in C# we do something like this: // Only method Form1 frm = new Form1(); frm.Show(); But in VB.Net we have both ways to do it: ' First common method Form1.Show() ' Second method Dim frm As New Form1() frm.Show() My question comes from this first method. What is this Form1 , is it an instance of Form1 or the Form1 class itself? Now as I mentioned above the Form name is the Default instance in VB.Net. But we also know that Form1 is a class defined in Designer so how can the names be same for both the Instance and class name? If Form1 is a class then there is no (Static\Shared) method named Show(). So where does this method come from? What difference they have in the generated IL? And finally why can't C# have an equivalent of this?
Tags (comma-separated)
Save Edits
Cancel