-
-
Notifications
You must be signed in to change notification settings - Fork 231
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
np operator ignores single member access when no default value passed in #520
Comments
Your observation is true. However, the only scenario in which this specific np() functionality is required to use if the Person can be null, correct? |
Yes. |
@zspitz Can you take a look at that PR to verify the unit tests? |
@StefH I cannot compile the solution:
under the |
@StefH The unit test at However, when no default value is passed, |
or just change And please review PR #522 to see the extra unit tests. |
@StefH Have you seen my previous comment? I would expect a selector like |
The logic here seems incorrect. Shouldn't it be |
@zspitz However for non-nullable types, the logic is not 100% correct yet, I think. public class X
{
public int Number {get;set;}
} With .Select("np(it.Number)") Generates currently with my fix: 1 2 3 |
I would suggest in your |
Code is fixed and returns |
1. Description
When using
np
with only one member access, thenp
operator seems to be ignored:Using
np
with multiple levels of member access seems to work, e.g.np(it.LastName.ToString())
:3. Fiddle or Project
https://dotnetfiddle.net/Ig09hL
The text was updated successfully, but these errors were encountered: