Skip to main content

.Net Core

.NET Core is a free, open-source, and cross-platform version of the .NET framework developed by Microsoft. It allows developers to build applications for Windows, Linux, and macOS using a single codebase. It includes a runtime, a set of libraries, and tools for building and deploying applications. .NET Core is designed to be lightweight and modular, making it suitable for building microservices and containerized applications.

The basics of .NET Core include:

The .NET Core Runtime: This is the core component of .NET Core and is responsible for executing the code of your applications.

The .NET Core Library: This is a set of libraries that provides a wide range of functionality, including collections, file I/O, and networking.

The .NET Core SDK: This is a set of tools that you can use to create, build, and deploy .NET Core applications.

C# or F#: These are the primary programming languages that you can use to write .NET Core applications. C# is a popular, general-purpose programming language, while F# is a functional programming language.

The ASP.NET Core Framework: This is a framework for building web applications and services on top of the .NET Core runtime. It includes features such as routing, middleware, and dependency injection.

The Entity Framework Core: This is an object-relational mapper that enables you to interact with databases using C# code.

The .NET Core CLI: This is a command-line interface that you can use to create, build, and deploy .NET Core applications.

By learning these basics, you can start building applications for different platforms like Windows, Linux, and macOS with the help of a single codebase and also can learn more advanced topics like dependency injection, Microservices, building web APIs and more.

The main application types for .NET Core are:

ASP.NET Core MVC: This is a web application framework that uses the Model-View-Controller (MVC) pattern to separate the application logic, user interface, and data. It enables you to build web applications that are highly testable and maintainable.

ASP.NET Core Web API: This is a framework for building RESTful web services on top of the .NET Core runtime. It makes it easy to create and consume HTTP services, and is often used to build microservices.

.NET Core Console Application: This is a simple command-line application that runs on .NET Core. It can be used for various purposes such as running background tasks, creating tools, or performing data processing.

.NET Core Worker Service: It is a console application that runs as a background service and can be used for long-running tasks such as running a message queue or scheduled tasks.

.NET Core Web Assembly: This is a way of building .NET applications that run in the browser using the WebAssembly standard. It allows you to write C# code that runs in the browser, giving you the ability to build web applications with rich user interfaces and offline functionality.

These are the main application types that you can build with .NET Core, but you can also use other frameworks like NancyFX, Giraffe, etc., to build other types of applications.

A .NET Core console application is a simple command-line application that runs on the .NET Core runtime. It can be used for various purposes such as running background tasks, creating tools, or performing data processing.

The main components of a .NET Core console application are:

The Main method: This is the entry point of the application and is where the execution of the program begins.

The Program class: This is the class that contains the Main method. It is typically defined in the Program.cs file.

The .NET Core runtime: This is the core component of .NET Core that is responsible for executing the code of your application.

The duty of a .NET Core console application is to take input from the user and perform a specific task or set of tasks based on the input and then provide the output. For example, it can be a simple calculator application that takes input as two numbers and an operator and performs the corresponding mathematical operation and returns the result.

To create a .NET Core console application, you will need to install the .NET Core SDK and use the "dotnet new" command to create a new project. You can then write the code for your application in the Main method and use the "dotnet run" command to execute the application.

The Console class provided in the .NET framework contains various methods to read and write from the console, you can use these methods to take input and provide output to the user.

using System;

class Program
{
    static void Main(string[] args)
    {
        // Get input from the user
        Console.WriteLine("Enter the first number:");
        double num1 = Convert.ToDouble(Console.ReadLine());
        
        Console.WriteLine("Enter the second number:");
        double num2 = Convert.ToDouble(Console.ReadLine());
        
        Console.WriteLine("Enter the operator (+, -, *, /):");
        string op = Console.ReadLine();

        double result = 0;
        // Perform the calculation based on the operator
        switch (op)
        {
            case "+":
                result = num1 + num2;
                break;
            case "-":
                result = num1 - num2;
                break;
            case "*":
                result = num1 * num2;
                break;
            case "/":
                result = num1 / num2;
                break;
            default:
                Console.WriteLine("Invalid operator");
                return;
        }

        // Display the result
        Console.WriteLine("Result: " + result);
    }
}

Comments

Popular posts from this blog

Crafting Clean Architecture: Guide readers through the principles and practices of Clean Architecture, emphasizing its benefits and applications.

In the ever-evolving world of software development, maintaining code quality and scalability becomes increasingly crucial. Amidst the complexities of modern applications, Clean Architecture emerges as a guiding light, offering a framework for building software that is flexible, testable, and understandable. Principles of Clean Architecture At its core, Clean Architecture revolves around four fundamental principles: Bounded Contexts: Divide the application into independent, self-contained modules called bounded contexts. Each bounded context focuses on a specific business domain, ensuring modularity and loose coupling. Dependency Rule: Software should depend on abstractions, not on concretions. This principle promotes loose coupling by making the core business logic independent of external frameworks or technologies. Interface Segregation Principle: Split interfaces into smaller, more focused interfaces. This principle reduces the complexity of interfaces and promotes code reusability. ...

React JS Basics in Sinhala

කොහොමද React ප්‍රොජෙක්ට් එකක් create කරගන්නේ... අපි මුලින්ම බලමු අපේ මැෂින් එකට React Js install කරගන්න කොට අපි කරන්න ඕන steps මොනවද කියලා.මුලින්ම අපිට මේ React Js use කරන්න අපිට අපේ මැෂින් එකේ node install කරලා තියෙන්න ඕනේ. අපි බලමු කොහොමද node install කරගන්නේ කියලා.  අපිට nodejs install කරගන්න පුලුවන් මෙන්න මේ site එක use කරල. මේ සයිට් එකට ගියාම ඔයාලට මෙන්න මේ විදිහට බලාගන්න පුළුවන්.මේකෙන් ඔයාලා use කරන operating system එකට අදාල ෆයිල් එක ඩවුන්ලෝඩ් කරගෙන  machine එකේ install කරගන්න පුලුවන්. ඔයාලට ඔයාලගේ machine එකේ node දැනටම install වෙලා තියෙනවද මේ එහෙම නැත්තං දැන් ඉන්ස්ටෝල් කරහම installation එක success වුනාද කියලා බලාගන්න ඕනනං ඔයාලට පුලුවන් මෙන්න මේ command එක යූස් කරන්න node --version ඔයාලට තියෙන්නේ Command Prompt open කරලා node --version command එක ගහන්න. එතකොට එනවා දැනට install වෙලා තියෙන node version එක. දැන් ඔයාලට බැලුවම පේනවා ඇති මගේ ඉන්ස්ටෝල් වෙලා තියෙන්නේ node V 12.14.0 කියන වර්ශන් එක.. දැන් අපි අපේ මැෂින් එකේ node install කරගත්තට react project එකත් develop කර...