Private Assembly
Wed Oct 29 2025 18:46:24 GMT+0000 (Coordinated Universal Time)
Saved by
@final
create a class library -> build
create a console app->solution explorer ->right click on project ->add->project referneces->add library
library:
using System;
namespace MyLibrary
{
public class Calculator
{
public int Add(int a, int b)
{
return a + b;
}
public int Multiply(int a, int b)
{
return a * b;
}
}
}
class:
using System;
using MyLibrary; // Namespace of the private assembly
class Program
{
static void Main()
{
Calculator calc = new Calculator();
int sum = calc.Add(10, 20);
int product = calc.Multiply(5, 6);
Console.WriteLine("Sum: " + sum);
Console.WriteLine("Product: " + product);
}
}
content_copyCOPY
Comments