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 pattern matching in PayloadHelper.cs to improve readability #1003

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sneznaj
Copy link

@sneznaj sneznaj commented Dec 2, 2021

Improves the readability using c# pattern matching
fixes #25

Improves the readability using c# pattern matching
fixes dotnet#25
@dnfadmin
Copy link

dnfadmin commented Dec 2, 2021

CLA assistant check
All CLA requirements met.

@sneznaj
Copy link
Author

sneznaj commented Dec 2, 2021

this was the last occurrence of this issue i found

if (type == typeof(byte[]))
{
return s_byteArrayTypeId;
}

if (type == typeof(int[]) ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be included in the switch expression ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a super long logical expression that would not fit well into that format
Screenshot 2021-12-08 at 01 28 40

{
return s_timestampTypeId;
}
_ when typeof(IJvmObjectReferenceProvider).IsAssignableFrom(type) => s_jvmObjectTypeId,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is exactly at the limit
Screenshot 2021-12-08 at 01 23 42

@suhsteve
Copy link
Member

suhsteve commented Dec 6, 2021

Looks like builds are failing. Can you look into it ?

@sneznaj
Copy link
Author

sneznaj commented Dec 8, 2021

i fixed one reason and the other one was there before

@AFFogarty
Copy link
Contributor

Hi @sneznaj, are you still working on this?

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

Successfully merging this pull request may close these issues.

Use C# pattern matching for matching types.
4 participants