class Person { public string Name { get; set; } public int Age { get; set; } } class Program { static void Main(string[] args) { Person person = new Person(); person.Name = "John Doe"; person.Age = 30; Console.WriteLine("Name: " + person.Name); Console.WriteLine("Age: " + person.Age); } }
using System; namespace MathLibrary { public class Math { public static int Add(int x, int y) { return x + y; } public static int Subtract(int x, int y) { return x - y; } } } class Program { static void Main(string[] args) { int result = MathLibrary.Math.Add(10, 5); Console.WriteLine("Result: " + result); } }This code creates a Math class in a package/library called MathLibrary. The Math class has two static methods, Add and Subtract, that perform mathematical operations. The Main method uses the Add method to add two numbers and displays the result on the console.