why do we have to put ' () ' when we want to define a new or array but we don't have to put it when we set predefined values ?? this problem is for c#, and its ok in VB.NET here is an example:
C#
class Program
{
static void Main(string[] args)
{
MyClass w = new MyClass();
MyClass w = new MyClass;//this line contain an error
MyClass e = new MyClass() { ss = "" };
MyClass g = new MyClass { ss = "" };
}
}
class MyClass
{
public string ss;
}
VB.NET
Sub Main()
Dim a As my_class = New my_class()
Dim v As my_class = New my_class
Dim b As my_class = New my_class() With {.ss = ""}
Dim n As my_class = New my_class With {.ss = ""}
End Sub
Class my_class
Public ss As String
End Class