Skip to content

Instantly share code, notes, and snippets.

View vdovinanton's full-sized avatar
🎯
Focusing

Anton Vdovin vdovinanton

🎯
Focusing
View GitHub Profile
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);
}
@vdovinanton
vdovinanton / myMatching.cs
Last active February 12, 2018 11:56
try to help
using System;
using System.Collections.Generic;
namespace index_property
{
#region resource implementations
public interface IResourceManager
{
void UseSomething();
}
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 December 4, 2016 13:26
Clean up dirty job from the DenKey
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApplication2
{
public class Program
{
static void Main(string[] args)
{