I support an application with VB.NET and C # components. I thought that these two languages differ only in syntax, but I found a strange function in VB.NET that is not in C #.
In VB.NET, I have the following class:
Public Class bill_staff Inherits System.Windows.Forms.Form .... End Class
If I want to use this class in C #, I do this:
using (var frm = new bill_staff()) frm.ShowDialog();
However, in VB.NET code, the class can be used as follows:
bill_staff.ShowDialog();
ShowDialog defined in the metadata as follows:
Public Function ShowDialog() As System.Windows.Forms.DialogResult
So, in VB.NET, you can call the instance method for the class. As far as I can tell, this implicitly creates a new instance of the class, and then calls the method on this object. In C #, this is not possible: static methods must be called in the class, and object objects must be called.
I can not find information about this on the Internet. What function is called, and is it good practice?
The project was originally converted from VB6 - is this some kind of weird inherited function?
source share