0% found this document useful (0 votes)
14 views23 pages

VISUAL PROGRAMMING and DOT NET TECHNOLOGIES LAB

The document outlines a syllabus for a Visual Programming and .NET Technologies lab course, detailing various C# programming tasks and objectives. It includes practical exercises such as displaying metadata, implementing constructors, and demonstrating inheritance and delegates. The course aims to equip students with skills in multi-tier application development using the .NET framework and covers key components like CLR and ASP.NET.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views23 pages

VISUAL PROGRAMMING and DOT NET TECHNOLOGIES LAB

The document outlines a syllabus for a Visual Programming and .NET Technologies lab course, detailing various C# programming tasks and objectives. It includes practical exercises such as displaying metadata, implementing constructors, and demonstrating inheritance and delegates. The course aims to equip students with skills in multi-tier application development using the .NET framework and covers key components like CLR and ASP.NET.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

VISUAL PROGRAMMING and DOT NET TECHNOLOGIES LAB SYLLABUS

Implement the following programs on Windows platform using C# language.

Prg.
Division of Programs List of Programs
No.

Write a program in C# and display its metadata,


Metadata
1 CIL, and manifest information using ildasm.exe
Information
tool.

Write a program in CIL for custom constructor and


2 Constructor
static constructor using console application.

Write a program in CIL to pass reference type by


3 Reference Types
value and reference type by reference.

Write a program in C# to create custom


Namespace and
4 namespaces. <br> Write a program in CIL to
Inheritance
demonstrate read only property.

Write a program in C# to demonstrate hybrid


5
inheritance.

Write a program in C# to demonstrate delegates.


Delegates and
6 <br> Write a program in C# to demonstrate
Interfaces
interfaces.

Array Write a program in C# to sort an array. <br> Write


7
Implementation a program in C# to create 2-D array.

Lab Questions &


8
Assignments
VISUAL PROGRAMMING and DOT NET TECHNOLOGIES LABORATORY
OBJECTIVE:
This course will cover the practical aspects of multi-tier application
development using the .NET framework. The goal of this course is to introduce
the students to the basics of distributed application development. We will
introduce the students to Web Service development and .NET remoting.
Technologies covered include the Common Language Runtime (CLR), .NET 1
framework classes, and C#.

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 void Main()

//Static Constructor and instance constructor, both are invoked for the first instance

Test3 t1 = new Test3();

// Only instance constructor is invoked Test3

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

static void Main(string[] args)

// Create an array

int[] array1 = { 1, 2, 3, 4, 5 };

// Pass array by value (creates a copy)

ChangeArray(array1);

Console.WriteLine("After passing by value: ");

PrintArray(array1);

// Pass array by reference (modifies original)

ChangeArrayRef(ref array1);

Console.WriteLine("After passing by reference: ");

PrintArray(array1);

Console.ReadKey();

static void ChangeArray(int[] arr)

for (int i = 0; i < arr.Length; i++)


{

arr[i] = arr[i] * 2;

static void ChangeArrayRef(ref int[] arr)

for (int i = 0; i < arr.Length; i++)

arr[i] = arr[i] * 3;

static void PrintArray(int[] arr)

foreach (int num in arr)

Console.Write(num + " ");

Console.WriteLine();

Output:

After passing by value: 1 2 3 4 5

After passing by reference: 3 6 9 12 15


Practical-4
Aim: Write a program in C# Language to create Custom Namespaces.

Program:

C#

using System;

using A.B.C;

using D;

namespace E

using F;

class Program

static void Main(string[] args)

// Can access CClass type directly from A.B.C

CClass var1 = new CClass();

// Can access DClass type from D

DClass var2 = new DClass();

// Must explicitly specify F namespace

F.FClass var3 = new F.FClass();

// Display types

Console.WriteLine(var1);

Console.WriteLine(var2);

Console.WriteLine(var3);

Console.ReadKey();

}
}

namespace A

namespace B

namespace C

public class CClass

// ...

namespace D

public class DClass

// ...

namespace F

public class FClass

// ...

}
}

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;

public class MyClass

private int x;

public int ReadOnlyProp { get; private set; } // Read-only property

public int WriteOnlyProp

set { x = value; }

public MyClass(int n)

x = n;

public int Add()

return x + 10;

class Test

static void Main()


{

MyClass mc = new MyClass(5);

mc.WriteOnlyProp = 10; // Set the value of the write-only property

Console.WriteLine(mc.ReadOnlyProp); // Access the read-only property

Console.WriteLine(mc.Add()); // Call the Add() method

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()

Console.WriteLine("This is class A.");

class B : A

public B()

Console.WriteLine("This is class B.");

class C : A

public C()

Console.WriteLine("This is class C.");

}
class D : B, C

public D()

Console.WriteLine("This is class D.");

class Program

static void Main(string[] args)

Console.WriteLine("Object of Class A created.");

A a = new A();

Console.WriteLine("\n\nObject of Class B created.");

B b = new B();

Console.WriteLine("\n\nObject of Class C created.");

C c = new C();

Console.WriteLine("\n\nObject of Class D created.");

D d = new D();

Console.ReadKey();

Output:

Object of Class A created.

This is class A.
Object of Class B created.

This is class A.

This is class B.

Object of Class C created.

This is class A.

This is class C.

Object of Class D created.

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 delegate void delmethod();

public class P

public static void display()

Console.WriteLine("Hello!");

public static void show()

Console.WriteLine("Hi!");

public void print()

Console.WriteLine("Print");

static void Main(string[] args)


{

// here we have assigned static method show() of class P to delegate delmethod()

delmethod del1 = P.show;

// here we have assigned static method display() of class P to delegate delmethod() using new
operator

// you can use both ways to assign the delegate

delmethod del2 = new delmethod(P.display);

P obj = new P();

// here first we have create instance of class P and assigned the method

// print() to the delegate i.e. delegate with class

delmethod del3 = obj.print;

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#

class Demo : abc

public static void Main()

System.Console.WriteLine("Hello Interfaces");

Demo refDemo = new Demo();

refDemo.xyz();

Sample refSample = new Sample();

refSample.xyz();

System.Console.ReadKey();

public void xyz()

System.Console.WriteLine("In Demo:: xyz");

interface abc

void xyz();

class Sample : abc

public 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

static void printarray(int[] arr)

Console.WriteLine("\n\nElements of array are:");

foreach (int i in arr)

Console.Write(" {0}", i);

static void Main(string[] args)

int[] arr = new int[5];

// loop for accepting values in array for

for (int i = 0; i < 5; i++)

Console.Write("Enter number: ");

arr[i] = Convert.ToInt32(Console.ReadLine());

Program.printarray(arr);
// sorting array value;

Array.Sort(arr); // use array's sort function

Program.printarray(arr);

Console.ReadLine();

Output

Enter number: 56

Enter number: 34

Enter number: 23

Enter number: 1

Enter number: 76

Elements of array are:

56 34 23 1 76

Elements of array are:

1 23 34 56 76

You might also like