Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Anton Vdovin vdovinanton

🎯
Focusing
  • Ukraine, Dnipro
View GitHub Profile
View CopyPropertiesHelper.cs
public static class CopyPropertiesHelper
{
public static void CopyPropertiesTo<T>(this T from, T to)
{
var fields = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance);
foreach (var field in fields)
{
var value = field.GetValue(from);
field.SetValue(to, value);
}
View myMatching.cs
using System;
using System.Collections.Generic;
namespace index_property
{
#region resource implementations
public interface IResourceManager
{
void UseSomething();
}
View gist:b75ef947a78b028a114d3c8bf63d3ce7
private static IEnumerable<CollectionMemberCached> Descendants(CollectionMemberCached root)
{
var nodes = new Stack<CollectionMemberCached>(new[] { root });
while (nodes.Any())
{
CollectionMemberCached node = nodes.Pop();
yield return node;
foreach (var n in node.Members)
nodes.Push(n);
}
@vdovinanton
vdovinanton / MatrixManager.cs
Last active Dec 4, 2016
Clean up dirty job from the DenKey
View MatrixManager.cs
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApplication2
{
public class Program
{
static void Main(string[] args)
{