"is" and "as" #2815
Replies: 6 comments
-
Err. Minor error in code snipped. Fixed online. |
Beta Was this translation helpful? Give feedback.
-
It might be interesting to see the different IL you're seeing in this case. |
Beta Was this translation helpful? Give feedback.
-
Unless the C# compiler is emitting different IL specifically for COM interfaces they should be roughly equivalent. A quick&dirty example on SharpLab yielded very similar IL: Method 1:
Method 2:
|
Beta Was this translation helpful? Give feedback.
-
This looks like a compiler bug, it would be greatly appreciated if you could provide a reproducer and post it as an issue in https://github.com/dotnet/roslyn |
Beta Was this translation helpful? Give feedback.
-
FWIW I can't reproduce this using |
Beta Was this translation helpful? Give feedback.
-
I'll try to put together an example later today.
On Sat, Sep 21, 2019 at 5:53 AM Yaakov ***@***.***> wrote:
FWIW I can't reproduce this using CERTENROLLLib.IAlternativeName as the
interface. I'm seeing identical IL in both scenarios.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://github.com/dotnet/csharplang/issues/2815?email_source=notifications&email_token=ADH2UVQCWY4KRDIOPVMZOO3QKX4MLA5CNFSM4IY2YNF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7IPNSQ#issuecomment-533788362>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADH2UVX22FXGFNS4WQIP5LLQKX4MLANCNFSM4IY2YNFQ>
.
--
Tony Valenti
Schedule a meeting with me
<https://www.fasterlaw.com/book-online/tony-valenti/book>
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have always understood the following code snippets to be equivalent:
and:
However, I recently ran into a situation involving COM interfaces where Method1 would yield true but Method2 would yield false.
How are
is
andas
related, specifically as it relates to COM interfaces?Beta Was this translation helpful? Give feedback.
All reactions