InfoViaLinq 3.0.1

Enable getting both 1) PropertyInfo 2) MethodInfo all using Linq

Install-Package InfoViaLinq -Version 3.0.1
dotnet add package InfoViaLinq --version 3.0.1
<PackageReference Include="InfoViaLinq" Version="3.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add InfoViaLinq --version 3.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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.

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.

Release Notes

Fixed minor garbage collection bug

  • .NETStandard 2.0

    • No dependencies.

Version History

Version Downloads Last updated
3.0.1 117 1/8/2019
3.0.0 87 1/8/2019
2.0.4 82 1/4/2019
2.0.3 125 8/28/2018
2.0.2 106 8/28/2018
2.0.1 200 7/14/2018
2.0.0 165 7/14/2018