C#Using Private Assembly

C#:Using Private Assembly


Introduction:


This is a continuation to my earlier posts :

1. C#-The-Language-A-Step-Ahead-Series-Part-I.aspx

2. C#:Creating Private Assembly

Write following code to use earlier created private assembly, but sure you have added the reference of created assembly.


/* This Example is a part of different
* examples shown in Book:
* C#2005 Beginners: A Step Ahead
* Written by: Gaurav Arora
* Reach at : msdotnetheaven*/

// File name : mathclassClient.cs

using System;
using System.Collections.Generic;
using System.Text;
using CSharp.AStepAhead.privateAssembly;

namespace CSharp.AStepAhead.privateAssemblyClient
{
class mathClassClient
{
static void Main(string[] args)
{
try
{
int x, y, o = 0;
mathClass myObj;
for (; ; )
{
Console.Clear();
Console.Write(" *** Math Operations *** \n");
Console.Write("\n 1 Addition");
Console.Write("\n 2 Substraction");
Console.Write("\n 3 Multiplication");
Console.Write("\n 4 Division");
Console.Write("\n 5 Square");
Console.WriteLine("\n 6 Exit");

Console.Write("\n Please Select Options [1-6] : ");
o = int.Parse(Console.ReadLine());
if (o <= 0 || o > 6)
{
Console.WriteLine("\n Invalid Selection!\n Try again!");
Console.ReadLine();
continue;
}
else if (o == 6)
{
Console.WriteLine("\n You are exiting!");
Console.ReadLine();
Console.Clear();
break;
}
else
{
Console.Write("\n Enter First Number: ");
x = int.Parse(Console.ReadLine());
Console.Write("\n Enter Second Number: ");
y = int.Parse(Console.ReadLine());

myObj = new mathClass(x, y, o);
Console.WriteLine("\n Assembly Details : " + myObj.GetAssemblyFullName());
Console.WriteLine("\n Result : " + myObj.ToString());
Console.ReadLine();

}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadLine();
}

}
}
}


Article by Gaurav Aroraa
Gaurav is a Microsoft Technology Specialist professional. He has awarded lifetime membership from Computer Society of India (CSI). He has more than 13yrs of experience in the industry. Currently, he is working in the capacity of Solution Architect with an MNC. He is serving to the various communities since 1999.

Follow Gaurav Aroraa or read 157 articles authored by Gaurav Aroraa

Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: