To understand Async and Await, first we need to understand about 'Task'. Task - This is used create thread but it will create thread from the thread pool and not from the computer operating system unlike normal Thread object in c# does. This is used to perform async operations 1. Task<TResult> - This return is used when the async method that returns a value. 2. Task - This return type is used when the async method does not return any value. 3. void - This return type is used for an event handler. We saw that concurrency refers to, in one way or another, doing several things at the same time. That concept of concurrency encompasses parallel programming and asynchronous programming. Parallel programming refers to the use of multiple threads simultaneously to solve a set of tasks. For this, we need processors with adequate abilities to perform several tasks at the same time. In general, we use parallel programming to gain speed. Asynchronous programming refers to the e...
Functions - It can be written in three ways in JavaScript. we developers always think of writing it in old ways which is called as 'Function Declaration way' ex : -It can be also written in variable assignment way. This is called 'Function expression' ex: The main difference between a function expression and a function declaration is the function name, which can be omitted in function expressions to create anonymous functions. Function expressions in JavaScript are not hoisted, unlike function declarations. You can't use function expressions before you create them: - Naming functions is useful if they need to reference themselves (e.g. for recursive calls). Indeed, if you are passing a literal function expression as an argument directly to another function, that function express...
string interpolation - It is mainly introduced to remove string. Format. It is a new way of concatenating strings, manipulating strings and formatting strings Null conditional operator - this is used to avoid nullreference exception like object reference not set to an instance of an object. When we use this operator : it returns null as a value and wont throw any exception. Auto-property Initializer - This is used to set the properties values when they are declared at their place itself. Before this, we should use class constructor to initialize the properties to their default values. Dictionary/Index initializers - Before c#6.0, if we create Dictionary object then if you want to add any items into it, then we need to use Add() method. Now in c#6.0, we can do it similar to collection or object initializer way. Expression-body-function : This is nothing but similar to writing normal code inside methods only this here we dont use "RETURN" keyword to return anything. Here we ...
Comments
Post a Comment