Skip to content

Dashue/Recursive-Reflections

Repository files navigation

Recursive reflection of pocos, enables you to do all sorts of magic.

public class WriteValueToConsoleAttribute : BaseRecursiveReflectionAttribute
{
    public override void Action(object property)
	{
		Console.WriteLine(property);
	}
}
	
[TestClass]
public class RecursiveReflectionTests
{
	[TestMethod]
	public void Usage()
	{
		var dto = new TestDto { MyText = "MyTextValue", MyList = new List<TestDto2> { new TestDto2 { Text = "MyText" } } };
		var reflector = new RecursiveReflector();
		reflector.Reflect(dto);
	}
}

public class TestDto2
{
	[WriteValueToConsole]
	public string Text { get; set; }
}

public class TestDto
{
	public List<TestDto2> MyList { get; set; }

	[WriteValueToConsole]
	public string MyText { get; set; }
}

About

Recursive reflection of dtos/pocos/models/viewmodels

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages