From dev-return-11727-apmail-lucenenet-dev-archive=lucenenet.apache.org@lucenenet.apache.org Tue Sep 22 16:32:03 2020 Return-Path: X-Original-To: apmail-lucenenet-dev-archive@www.apache.org Delivered-To: apmail-lucenenet-dev-archive@www.apache.org Received: from mailroute1-lw-us.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by minotaur.apache.org (Postfix) with ESMTP id 31E8319782 for ; Tue, 22 Sep 2020 16:32:03 +0000 (UTC) Received: from mail.apache.org (localhost [127.0.0.1]) by mailroute1-lw-us.apache.org (ASF Mail Server at mailroute1-lw-us.apache.org) with SMTP id C862B123B02 for ; Tue, 22 Sep 2020 16:32:02 +0000 (UTC) Received: (qmail 41051 invoked by uid 500); 22 Sep 2020 16:32:02 -0000 Delivered-To: apmail-lucenenet-dev-archive@lucenenet.apache.org Received: (qmail 41010 invoked by uid 500); 22 Sep 2020 16:32:02 -0000 Mailing-List: contact dev-help@lucenenet.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucenenet.apache.org Delivered-To: mailing list dev@lucenenet.apache.org Received: (qmail 40993 invoked by uid 99); 22 Sep 2020 16:32:02 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Sep 2020 16:32:02 +0000 From: =?utf-8?q?GitBox?= To: dev@lucenenet.apache.org Subject: =?utf-8?q?=5BGitHub=5D_=5Blucenenet=5D_theolivenbaum_commented_on_pull_reque?= =?utf-8?q?st_=23345=3A_Reduce_casting?= Message-ID: <160079232219.32230.10857331947148136335.asfpy@gitbox.apache.org> Date: Tue, 22 Sep 2020 16:32:02 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit In-Reply-To: References: 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