I want to ask that as in C, we can initilase the structures as in the follwoing example, Is it also possible to do same in Vb.net. I have tried but error is coming.
C Example
#include<stdio.h>
#include<conio.h>
void main()
{
struct student
{
int roll;
char grade[5];
} ;
struct student s1={1,"a"};
clrscr();
printf("%d %s",s1.roll,s1.grade);
getch();
}
VB.Net Example
Module Module1
Public Structure student
Public roll As Integer
Public name As String
End Structure
Sub Main()
Dim obj As student = {1, "sonia"}
Console.WriteLine(obj.roll)
Console.WriteLine(obj.name)
Console.ReadLine()
End Sub
End Module