---
title: "Simplest an fastest C# Expression that always evaluates to false and does not generate a compiler warning"  
description: "Simplest an fastest C# Expression that always evaluates to false and does not generate a compiler warning"  
author: "Anonymous User"  
published: 2013-05-13  
updated: 2013-05-13  
canonical: https://www.mindstick.com/forum/877/simplest-an-fastest-c-sharp-expression-that-always-evaluates-to-false-and-does-not-generate-a-compiler-warning  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Simplest an fastest C# Expression that always evaluates to false and does not generate a compiler warning

Hi Everyone!\
I have a rather esoteric case where I need to have some piece of code that will never [execute](https://www.mindstick.com/interview/49/how-can-i-execute-a-php-script-using-command-line) but which still needs to be part of the [compilation](https://www.mindstick.com/interview/358/which-is-the-first-level-of-compilation-in-the-dot-net-languages) output. Although I could come up with my own, I'm asking the [community](https://yourviews.mindstick.com/view/87457/khalistan-community-a-threat-to-india): What is the simplest and fastest C# [Expression](https://www.mindstick.com/articles/1861/sqlite-expressions) that always evaluates to false and does not generate a [compiler](https://www.mindstick.com/articles/27/just-in-time-compiler) warning and preserves the enclosed block of code in the final build output?\
Update: Since explaining the rationale behind the [question](https://www.mindstick.com/blog/23175/how-to-solve-neet-question-paper-in-less-time) was requested: The Mono touch linker performs static code [analysis](https://www.mindstick.com/articles/323533/prospective-analysis) in order to strip all unreferenced symbols out of the final build to decrease the size of the generated binaries. This poses a [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) with [properties](https://www.mindstick.com/articles/23331/nootropics-7-different-types-and-their-unique-properties) only accessed through reflection.\
Any help will be appreciated! Thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)!\
\
\

## Replies

### Reply by AVADHESH PATEL

Hi Goti!\
Try as following\
public static bool False() { return false;}public static void Foo() { if (False()) { ... }}\
If you need to convince JIT too (inlining), then add [MethodImpl(MethodImplOptions.NoInlining)] to False()


---

Original Source: https://www.mindstick.com/forum/877/simplest-an-fastest-c-sharp-expression-that-always-evaluates-to-false-and-does-not-generate-a-compiler-warning

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
