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.

Is MVC a framework?

The Model-View-Controller (MVC) is an architectural pattern that separates an application into three main logical components: the model, the view, and the controller. MVC is one of the most frequently used industry-standard web development frameworks to create scalable and extensible projects.

Is MVC is a design pattern?

Model–view–controller (usually known as MVC) is a software design pattern commonly used for developing user interfaces that divide the related program logic into three interconnected elements.

What is design pattern with example?

 Design patterns provide a standard terminology and are specific to particular scenario. For example, a singleton design pattern signifies use of single object so all developers familiar with single design pattern will make use of single object and they can tell each other that program is following a singleton pattern.

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.