Skip to content

amir734jj/InfoViaLinq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

InfoViaLinq

This is a rewrite of my other project GetPropertyInfoViaLinq. The goal of re-write to enable getting both 1) PropertyInfo 2) MethodInfoall using Linq.

Nuget link

Examples to get PropertyInfo via Linq:

IInfoViaLinq<Person> _utility = InfoViaLinq<Person>.New();

// returns: "Parents.GreatParents.Parents.FatherName"
string.Join('.', _utility.PropLambda(x => x.Parents.GreatParents.Parents.FatherName).Members().Select(x => x.Name));

// returns custom attributes via linq
_utility.PropLambda(x => x.Parents.GreatParents.Parents.FatherName).Members().Last().GetAttribute<DisplayAttribute>();

// returns PropertyInfo of "FatherName" via linq
_utility.PropLambda(x => x.Parents.GreatParents.Parents.FatherName).Members().Last();

Examples to get MethodInfo via Linq:

var str = InfoViaLinq<string>.New().FuncLambda<string>(x => x.ToString).GetMethodInfo().Name;
// "ToString"

var str = InfoViaLinq<string>.New().FuncLambda<int>(x => x.CompareTo).GetMethodInfo().Name;
// "CompareTo"

Notes:

  • To get MethodInfo code supports void methods and methods with up-to three parameters.

About

Rewrite of GetPropertyInfoViaLinq, more modular +MethodInfo support

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages