c# namespace example

/// Namespaces introduction example

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ConsoleApplication1.MyDrawing;
using ConsoleApplication1.MyGraphics;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            MyDrawing.Class1 c1 = new MyDrawing.Class1();
            MyGraphics.Class1 c2 = new MyGraphics.Class1();

            c1.DrawingFunction();
            c2.ShowGraphics();
        }
    }
}

/// Nested Namespaces example
/// to run this example, create two folders, MyDrawing, and MyGraphics. Create Class1 in MyDrawing and Class1 in MyGraphics
/// create another folder named Colors in MyGraphics. Add a class named ColorSelection in MyGraphics

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ConsoleApplication1.MyGraphics.Colors;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            MyDrawing.Class1 c1 = new MyDrawing.Class1();
            MyGraphics.Class1 c2 = new MyGraphics.Class1();

            c1.DrawingFunction();
            c2.ShowGraphics();

            ColorSelection c3 = new MyGraphics.Colors.ColorSelection();
            c3.SelectColor();
        }
    }
}

 

Add a Comment

Your email address will not be published. Required fields are marked *