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

Use switch expressions from C# 8 #1264

merged 1 commit into from Jan 29, 2019


Copy link

@jskeet jskeet commented Jan 29, 2019

No description provided.

@jskeet jskeet merged commit 695736f into nodatime:master Jan 29, 2019
1 of 2 checks passed
@jskeet jskeet deleted the switch-expressions branch Jan 29, 2019
return null;
"GregorianCalendar" => CalendarSystem.Iso,

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,

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

Copy link
Member Author

@jskeet jskeet Feb 11, 2019

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
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants