VISUAL PROGRAMMING and DOT NET TECHNOLOGIES LAB
VISUAL PROGRAMMING and DOT NET TECHNOLOGIES LAB
Prg.
Division of Programs List of Programs
No.
OUTCOMES:
Upon the completion of Visual Programming and Dot Net Technologies
practical course, the student will be able to:
1. Explain the role of basic components used in: .NET Framework- CLR, CTS,
CLS & BCLS.
2. Write, compile and debug C# program in Console (CSC.EXE) as well as in
IDE (Visual Studio)
3. Write, compile and debug object oriented program in C#.
4. Write, compile and debug object oriented program using interfaces and
collections.
5. Design and develop small web applications/sites using ASP.NET
6. Create & Deploy .NET assemblies (Private and Shared).
7. Apply problem-solving techniques to solve real-world problems.
LIST OF PRACTICALS
Program 1. Write a program in C# and display its metadata, CIL, and manifest
information using ildasm.exe tool.
Program 2. Write a program in C# for custom constructor and static constructor
using console application.
Program 3. Write a program in C# to pass reference type by value and
reference type by reference.
Program 4. Write a program in C# to create custom namespaces.
Program 5. Write a program in C# to demonstrate read only property.
Program 6. Write a program in C# to demonstrate hybrid inheritance.
Program 7. Write a program in C# to demonstrate delegates.
Program 8. Write a program in C# to demonstrate interfaces.
Program 9. Write a program in C# to sort an array.
Program 10. Write a program in C# to create 2-D array.
Practical-1
Aim: Write a Program in C# and display its Metadata, CIL, and Manifest information using ildasm.exe
tool.
Program:
C#
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < i; j++)
{
Console.Write("*");
}
Console.WriteLine();
}
Console.ReadKey();
}
}
}
Practical-2
Aim: Write a program in C# for custom constructor and static constructor using console application.
Program:
C#
namespace ProgramCall
class Test3
public Test3()
Console.WriteLine("Instance Constructor");
static Test3()
Console.WriteLine("Static Constructor");
class StaticConstructor
//Static Constructor and instance constructor, both are invoked for the first instance
t2 = new Test3();
Console.ReadKey();
}
Output:
Static Constructor
Instance Constructor
Instance Constructor
Practical-3
Aim: Write a program to pass reference type by value and reference type by reference.
Program:
C#
using System;
namespace ReferenceType
class Program
// Create an array
int[] array1 = { 1, 2, 3, 4, 5 };
ChangeArray(array1);
PrintArray(array1);
ChangeArrayRef(ref array1);
PrintArray(array1);
Console.ReadKey();
arr[i] = arr[i] * 2;
arr[i] = arr[i] * 3;
Console.WriteLine();
Output:
Program:
C#
using System;
using A.B.C;
using D;
namespace E
using F;
class Program
// Display types
Console.WriteLine(var1);
Console.WriteLine(var2);
Console.WriteLine(var3);
Console.ReadKey();
}
}
namespace A
namespace B
namespace C
// ...
namespace D
// ...
namespace F
// ...
}
}
Output:
A.B.C.CClass
D.DClass
F.FClass
Practical-5
Aim: Write a Program in C# Language to demonstrate read only property and write only property.
Program:
C#
using System;
private int x;
set { x = value; }
public MyClass(int n)
x = n;
return x + 10;
class Test
Console.ReadKey();
Output:
10
15
Practical-6
Aim: To write a program in C# Language to demonstrate Hybrid Inheritance.
Program:
C#
using System;
namespace ConsoleApplication1
class A
public A()
class B : A
public B()
class C : A
public C()
}
class D : B, C
public D()
class Program
A a = new A();
B b = new B();
C c = new C();
D d = new D();
Console.ReadKey();
Output:
This is class A.
Object of Class B created.
This is class A.
This is class B.
This is class A.
This is class C.
This is class A.
This is class B.
This is class D.
Practical-7
Aim: Write a program in C# Language to demonstrate Delegates.
Program:
C#
using System;
namespace ConsoleApplication5
class Program
public class P
Console.WriteLine("Hello!");
Console.WriteLine("Hi!");
Console.WriteLine("Print");
// here we have assigned static method display() of class P to delegate delmethod() using new
operator
// here first we have create instance of class P and assigned the method
del1();
del2();
del3();
Console.ReadLine();
Output:
Hi!
Hello!
Print
Practical-8
8. Aim: Write a program in C# Language to demonstrate Interfaces inheritance.
Program:
C#
System.Console.WriteLine("Hello Interfaces");
refDemo.xyz();
refSample.xyz();
System.Console.ReadKey();
interface abc
void xyz();
{
System.Console.WriteLine("In Sample xyz");
Output:
Hello Interfaces
In Demo:: xyz
In Sample xyz
Practical-9
Aim: Write a program of sorting an array. Declare single dimensional array and accept 5 integer
values from the user. Then sort the input in ascending order and display output.
**using System;
namespace Example 1
class Program
arr[i] = Convert.ToInt32(Console.ReadLine());
Program.printarray(arr);
// sorting array value;
Program.printarray(arr);
Console.ReadLine();
Output
Enter number: 56
Enter number: 34
Enter number: 23
Enter number: 1
Enter number: 76
56 34 23 1 76
1 23 34 56 76