DEV Community

Haris Iftikhar
Haris Iftikhar

Posted on • Updated on

Creating your First .NET Component

To start things out, you'll need to create an empty directory anywhere in your local machine. Open up the directory in any text environment or IDE of your choice. (I used Visual Studio Code). Create a new C# script and name it as main.cs.

Write the following code in it.
Image description

After that, create additional independent C# scripts containing static functions for all the basic arithmetic operators:

For addition:
Image description

For subtraction:
Image description

For multiplication:
Image description

For division:
Image description

For modulus:
Image description

Before Compilation:
Image description

During Compilation:
Image description

After Compilation:
Image description

Compiling main.cs
Image description

Output:
Image description

Hence, we have successfully created our first .NET Component!

Top comments (0)