Posts

Showing posts with the label .Net Basics

SOLID Principle in C#

Image
 

NLog in a console application

Image
  Implementing NLog in a console application is a straightforward process. Here are the steps to set up NLog in a C# console application: Step 1: Install NLog Package First, you need to install the NLog package in your console application. You can do this using the Package Manager Console or the .NET CLI. Open the Package Manager Console and run the following command: bash Copy code Install-Package NLog Or, if you prefer using .NET CLI, run: bash Copy code dotnet add package NLog Step 2: Configure NLog Create an NLog.config file in your console application project. This file will contain the configuration for NLog. Here's an example configuration that writes log messages to a file: xml Copy code <?xml version="1.0" encoding="utf-8" ?> <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autoReload="true" internalLogLevel="info" internalLogFile=...

OOPS In C#

Object Oriented Programming (OOP) concepts Abstraction  Encapsulation  Inheritance Polymorphism OOP Features The software is divided into a number of small units called objects. The data and functions are built around these objects. The data of the objects can be accessed only by the functions associated with that object. The functions of one object can access the functions of another object Class ·          A class is the core of any modern Object Oriented Programming language ·          A class is a blueprint of an object that contains variables for storing data and functions to perform operations on the data.  ·          A class will not occupy any memory space and hence it is only a logical representation of data. Example class Employee {   } . Object An object is a software bundle o...