Friday, August 21, 2020

.net core and .net framework difference

Developers use the. NET framework to create Windows desktop applications and server-based applications. This includes ASP.NET web applications. NET Core is used to create server applications that run on Windows, Linux, and Mac.

SingleorDefault vs Firstordefault example

Single

It returns a single specific element from a collection of elements if the element match found. An exception is thrown, if none or more than one match found for that element in the collection.


SingleOrDefault

It returns a single specific element from a collection of elements if the element match found. An exception is thrown if more than one match found for that element in the collection. The default value is returned, if no match is found for that element in the collection.


First

It returns the first specific element from a collection of elements if one or more than one match found for that element. An exception is thrown, if no match is found for that element in the collection.


FirstOrDefault

It returns the first specific element from a collection of elements if one or more than one match found for that element. The default value is returned, if no match is found for that element in the collection.


Tuesday, August 18, 2020

When to use Interface?

 If your child classes should implement a certain group of methods/functionalities but each of the child classes is free to provide its own implementation then use interfaces.

Sunday, August 16, 2020

When to use Abstract Classes in C#?

 When we have a requirement where our base class should provide the default implementation of certain methods whereas other methods should be open to being overridden by child classes use abstract classes.

Friday, August 14, 2020

How can you detect the client's browser name?

 You can use the navigator. appName and navigator. userAgent properties.

C# Destructor Syntax

 class User

    {

        // Destructor

        ~User()

        {

            // your code

        }

    }

Thursday, August 13, 2020

visual studio component model cache clear

 %localappdata%\Microsoft\VisualStudio\ -- Goto 12.0 or particular visual studio 14.0 delete component cache model inside folders. 

Wednesday, August 12, 2020

What is the difference between struct and class in c#

 Difference between Structs and Classes 

Structs are value type whereas Classes are reference type. 

Structs are stored on the stack whereas Classes are stored on the heap. 

When you copy struct into another struct, a new copy of that struct gets created modified of one struct won't affect the value of the other struct.

Class can create a subclass that will inherit parent's properties and methods, whereas Structure does not support the inheritance. 

A class has all members private by default. 

A struct is a class where members are public by default. 

 Boxing and unboxing operations are used to convert between a struct type and object.

Friday, August 7, 2020

What are the return types in MVC?

Various Return Types From MVC Controller

System.Web.Mvc.ContentResult.

System.Web.Mvc.EmptyResult.

System.Web.Mvc.FileResult.

System.Web.Mvc.HttpStatusCodeResult.

System.Web.Mvc.JavaScriptResult.

System.Web.Mvc.JsonResult.

System.Web.Mvc.RedirectResult.

System.Web.Mvc.RedirectToRouteResult.

Why do we use MVC pattern?

 MVC is an acronym for Model, View, and Controller. It's a product development architecture. With the emerge of MVC approach, it helps you create applications that separate the different aspects of the application (input logic, business logic, and UI logic) while providing a loose coupling between these elements.