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 first element from a sequence, but here there is an advantage over First(), so if there is no record in the collection which matches input criteria then FirstOrDefault() can handle null values and it does not throw an exception.
IEnumerable in C#
IEnumerable is an interface that is available in the System.Collections namespace.
IQueryable in C#:
The IQueryable is an interface that exists in the System.Linq Namespace.
PUT method is called when you have to modify a single resource.
POST method is called when you have to add a child resource.
async -An async keyword is a method that performs asynchronous tasks such as fetching data from a database.
Comments
Post a Comment