lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [lucenenet] NightOwl888 commented on pull request #345: Reduce casting
Date Tue, 22 Sep 2020 16:47:53 GMT

NightOwl888 commented on pull request #345:

   Interesting. I suspect they wouldn't produce the same IL if the type in the comparison
had the `!=` operator overloaded - then it may produce very different results, and in fact
depending on the implementation it might not produce expected results. `is` is safer because
it doesn't take the operator overloads into account.
   That said, I am on board with elad in that using `== object` is not very intuitive for
a `null` check. I prefer:
       public static void A(IMyInterface c) {
           if(!(c is null) && c is MyClass cc) {

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:

View raw message