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 IsInstanceOfType instead of IsAssignableFrom #8102

Conversation

SimonCropp
Copy link
Contributor

No description provided.

@SimonCropp SimonCropp requested a review from a team as a code owner June 12, 2024 10:58
Copy link
Member

@Forgind Forgind left a comment

Choose a reason for hiding this comment

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

Is there a significant difference between these two perf-wise? They look pretty much the same to me.

@SimonCropp
Copy link
Contributor Author

no there is no perf difference. i just find IsInstanceOfType more readable since there is less noise without the .GetType()

Copy link
Member

@MiYanni MiYanni left a comment

Choose a reason for hiding this comment

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

I looked into it via our docs:

After some research, for this situation, they should function the same way. I think this answer on SO is a good explanation of when to use these methods: https://stackoverflow.com/a/15853224/294804

@MiYanni MiYanni merged commit 7536c8b into dotnet:main Jun 12, 2024
10 checks passed
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.

3 participants