Friday, August 7, 2020

What is meant by design pattern?

 In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern isn't a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations.

What is difference between Dispose and Finalize in C#?

 The Finalize method is used to perform cleanup operations on unmanaged resources held by the current object before the object is destroyed. The method is protected and therefore is accessible only through this class or through a derived class.

Can abstract class be sealed in C#?

 When a class is declared sealed, it cannot be inherited, abstract classes cannot be declared sealed. To prevent being overridden, use the sealed in C#. When you use sealed modifiers in C# on a method, then the method loses its capabilities of overriding.

Why do we use keyword in C#?

 The using keyword has three major uses: The using statement defines a scope at the end of which an object will be disposed. The using directive creates an alias for a namespace or import types defined in other namespaces. The using static directive imports the members of a single class.

Can abstract class have constructor in C#?

 Yes, an abstract class can have a constructor. In general, a class constructor is used to initialize fields. Along the same lines, an abstract class constructor is used to initialize fields of the abstract class.

What is the use of virtual keyword in C#?

The virtual keyword is used to modify a method, property, indexer, or event declared in the base class and allow it to be overridden in the derived class. The override keyword is used to extend or modify a virtual/abstract method, property, indexer, or event of base class into derived class. 

Why abstraction is used in C#?

Abstraction allows making relevant information visible and encapsulation enables a programmer to implement the desired level of abstraction. Abstraction can be achieved using abstract classes in C#. C# allows you to create abstract classes that are used to provide a partial class implementation of an interface.

Thursday, August 6, 2020

how to call web api method in client application c#

HttpClient class provides a base class for sending/receiving the HTTP requests/responses from a URL.
Example.
In this example, I have created a console application.
To call Web API methods from the console Application, the first step is to install the required packages, using the NuGet Package Manager.

Is it necessary to override a virtual method in C#?

C# virtual keyword is used to create virtual methods in C#. A virtual method is a method that can be redefined in derived classes. When a method is declared as a virtual method in a base class and that method has the same definition in a derived class then there is no need to override it in the derived class.a

Tuesday, August 4, 2020

error occurred while configuring nuget package manager

Goto Package console manager and download or restore 
And enable the NuGet console manager.
and build