Skip to content

Instantly share code, notes, and snippets.

Avatar
🤠
Adept Coder - Full Stack Developer

Ankit Kanojia ankitkanojia

🤠
Adept Coder - Full Stack Developer
View GitHub Profile
@ankitkanojia
ankitkanojia / helper.cs
Created Sep 2, 2019
Copy property function to copy all properties from one object to another using reflection
View helper.cs
// Common function which is use to copy or make a clone of one object to another with datatype and value
public static void CopyProperties<TSelf, TSource>(this TSelf self, TSource source)
{
try
{
var sourceAllProperties = source.GetType().GetProperties();
foreach (var sourceProperty in sourceAllProperties)
{
var selfProperty = self.GetType().GetProperty(sourceProperty.Name);
@ankitkanojia
ankitkanojia / sample.js
Last active Sep 2, 2019
Javascript or Jquery loop iterations, Different type of loop iterations.
View sample.js
var arrayCollection = [“ABC”, “DEF”, “HIJ”];
$.each(arrayCollection, function(index, value){
console.log(“index : ,index, value :, value);
});
$(arrayCollection).each(function(index, value){
console.log(“index : ,index, value :, value);
});