Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Given example throws exception #4

Open
graemejob opened this issue May 27, 2023 · 0 comments
Open

Given example throws exception #4

graemejob opened this issue May 27, 2023 · 0 comments

Comments

@graemejob
Copy link

RoslynPad code:

#r "nuget: ExpressionDelegates.Base, 1.0.0"
using ExpressionDelegates;
using System.Linq;
using System.Linq.Expressions;

Expression<Func<string, int>> expression = s => s.Length;
MemberInfo accessorInfo = ((MemberExpression)expression.Body).Member;

Accessor lengthAccessor = ExpressionDelegates.Accessors.Find(accessorInfo);

**var value = lengthAccessor.Get("17 letters string");** 

ExpressionDelegates.Accessors.Find returns null, so .Get causes a null reference exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant