Posts

Showing posts from September 7, 2023

Extension Method & Partial Class

  Extension - extension method allows you to add new methods in the existing class or in the structure without modifying the source code of the original type and you do not require any kind of special permission from the original type and there is no need to re-compile the original type. Partial Class- It provides a special ability to implement the functionality of a single class into multiple files and all these files are combined into a single class file when the application is compiled. A partial class is created by using a partial keyword. First(): it returns the first element from a sequence means when we query in a collection on specific criteria, if multiple elements are found in a collection of given criteria then the first element of a sequence will return. -First it can't handle the null value. var emp = Employee.GetAllEmp().Where(x => x.Name == "Ashutosh").First();   FirstOrDefault(): FirstOrDefault works same as First() does, FirstOrDefault returns the ...

Filters In MVC

 Authentication Filters: Authentication filter runs before any other filter or action method. Authentication confirms that you are a valid or invalid user. Authorization Filters:  Authorization Filters are responsible for checking User Access. These filters used to implement authentication and authorization for controller actions. Action Filters : Action Filter is an attribute that you can apply to a controller action or an entire controller. This filter will be called before and after the action starts executing and  after the action has executed. Result Filters: The Output Cache Attribute class is an example of Result Filters. These implement the IResult Filter interface which like the IAction Filter has OnResult Executing and OnResult Executed. These filters contain logic that is executed before and after a view result is executed.  Like if you want to modify a view result right before the view is rendered to the browser. Exception Filters :  The HandleErrorA...

Popular posts from this blog

String Program in C#

CSV using XmlNode

Controller_Model. cs