lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [lucenenet] theolivenbaum commented on pull request #345: Reduce casting
Date Tue, 22 Sep 2020 16:32:02 GMT

theolivenbaum commented on pull request #345:
URL: https://github.com/apache/lucenenet/pull/345#issuecomment-696835930


   @NightOwl888 just checking on [sharplab again](https://sharplab.io/#v2:C4LghgzgtgPgAgJgIwFgBQ64GYAEBLAO2AFMAnAMzAGNicBJAWQE86izKacBvAX3U1yIczAMIAbSBBwh6zViQrVaXHHwzrsOOEgBsWhDgAqxCMG7oclnBaubteuABYcAQQAUjFm0WcqASnM0K2D8cjcqHABCAF4cAgBXMTEcADIUnAi8KVEJCCkqf0CQ4q0kAE5wqgA6AHFiYEMmAAdiNz8/AG4bYrVg3qturUFdLWcAIQ85bw5aQq5B4LwwiJi4xLEA+aCS4IA3MFIcKDAmACNaWIjIYSZxSS7tncslt2Oz2lWEpL8tp5LtCpvc61eqNFptToLEr9HqDGHWR5DUoOZwiSZeBQzDKbKHPZb4bK3XL5KgIHGInYAyoIEENZqtdoPHbwnjBQaDOwjJw4AAi6Pk7CU2KKJRemSkAHtTgArYhUMxpDIEm53PIZUnkv6WKkFGl1Ongxm41Rw9A8IA).
It seems both these options produce the exact same IL/ASM:
   
   ```
       public static void A(IMyInterface c) {
           if(c != null && c is MyClass cc) {
               Console.WriteLine(cc.GetType());
           }
       }
   ```
   
   ```
       public static void D(IMyInterface c) {
           if(c is object && c is MyClass cc2) {
               Console.WriteLine(cc2.GetType());
           }
       }
   ```
   
   Do you prefer I undo the pattern matching changes, or add the extra `is object` to them
so moving forward you also don't get the warning on VS?
   
   
   


----------------------------------------------------------------
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:
users@infra.apache.org



Mime
View raw message