Iterable object will have a Symbol.iterator proto .Sets,Weak Set,Maps, Weak Maps are newly introduced Javascript Iterable datatypes ."for of" is a new for loop that can be used with the itrable datatypes .Set do not store duplicate values. reference Site -https://www.youtube.com/watch?v=TJpkYvSREtM let mySet = new Set([1,2,2,3,4]) console.dir(mySet); for (let v of mySet){ console.log(v); } //Use of Symbol.iterator traverse through elements let myArray=[1,2,3,4]; let iterator= myArray[Symbol.iterator](); console.log(iterator.next()); //output {value: 1 and done :false } (value is the element present in the index and done :false,the array is not yet completed console.log(iterator.next()); console.log(iterator.next()); console.log(iterator.next()); console.log(iterator.next()); let NumArray=[1,2,3,4]; console.dir(NumArray); //non iterable object will not have a Symbol.iterator proto let anyOtherObject={ name: "John", ...
The Authentication technique used mainly by token based with OWIN, Step was to register a user , We created a appliction form to submit the user credentials to the WEB API Post Mehtod and saved in the database . We have built a repository class which interacts with the database and gives the required result-set when requested for , We have also introduced a Business Layer which handles the business logics and acts as model for the controller . The implementations of the Authentication and Authorization is done from this site . http://bitoftech.net/2014/06/01/token-based-authentication-asp-net-web-api-2-owin-asp-net-identity/ The Controller Class using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; using WebApiDemo.Models; namespace WebApiDemo.Controllers { public class EmployeeController : ApiController { [Authorize] ...
While browsing through questions of C# , I came across this question If A.equals(B) is true then A.getHashcode & B.getHashCode must always return same hash code I found this interesting example in the site --https://vkreynin.wordpress.com/2008/07/05/explaining-gethashcode-method/ Which explains this questions . A hash code is a numeric value that is used to insert and identify an object in a hash-based collection such as the Dictionary<TKey, TValue> class, the Hashtable class, or a type derived from the DictionaryBase class. The GetHashCode method provides this hash code for algorithms that need quick checks of object equality. Two objects that are equal return hash codes that are equal. However, the reverse is not true: equal hash codes do not imply object equality, because different (unequal) objects can have identical hash codes. using System; public class Point { private readonly int _x; ...
Comments
Post a Comment