This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace ConsoleApplication2 | |
{ | |
public class Program | |
{ | |
static void Main(string[] args) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
namespace index_property | |
{ | |
#region resource implementations | |
public interface IResourceManager | |
{ | |
void UseSomething(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |