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

Use switch expressions from C# 8 #1264

Merged
merged 1 commit into from Jan 29, 2019

Conversation

Projects
None yet
2 participants
@jskeet
Copy link
Member

jskeet commented Jan 29, 2019

No description provided.

@jskeet jskeet merged commit 695736f into nodatime:master Jan 29, 2019

1 of 2 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@jskeet jskeet deleted the jskeet:switch-expressions branch Jan 29, 2019

return null;
}
}
"GregorianCalendar" => CalendarSystem.Iso,

This comment has been minimized.

@mungojam

mungojam Feb 11, 2019

Could you switch based on the actual class type now, instead of having to use .GetType().Name(), i.e.:

bcl switch
{
    GregorianCalendar _  => CalendarSystem.Iso,
    HijriCalendar _ => CalendarSystem.IslamicBcl,
//etc.
}

Not sure if the _ is actually needed or can be left out altogether

This comment has been minimized.

@jskeet

jskeet Feb 11, 2019

Author Member

We couldn't do so before, not due to switch expressions but because we couldn't refer to the specific calendar system types in more limited environments.
Now we only support netstandard2.0, this might be feasible - thanks for highlighting it. Will have a look...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment