Professional Documents
Culture Documents
methods.
Co-1 BL- 6
using System;
class Program
{
static void Main(string[] args)
{
// Static method example
string str_0 = "Anshul";
string str_1 = "anshul";
Console.ReadKey();
}
}
Question : Create a program in c# to show difference between struct and
class
Co-1 BL- 6
using System;
// Define a struct
struct MyStruct
{
public int x;
}
// Define a class
class MyClass
{
public int x;
}
class Program
{
static void Main(string[] args)
{
// Create an instance of the struct
MyStruct structInstance = new MyStruct();
structInstance.x = 5;