
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
Empty List in C#
Set a list that has zero elements −
List<string> myList = new List<string>();
Now check whether the list is empty or null −
Console.WriteLine(myList == null);
Above, returns “False” i.e. the list is not null - the list is empty.
Let us see the complete code −
Example
using System; using System.Collections.Generic; using System.Linq; public class Demo { public static void Main() { List<string> myList = new List<string>(); // returns false i.e. an empty list (not a null list) Console.WriteLine(myList == null); } }
Output
False
- Related Articles
- list empty() function in C++ STL
- First Non-Empty String in list in Python
- How to initialize a list to an empty list in C#?
- How to empty a C# list?
- How to create an empty list in Python?
- How do I empty a list in Java?
- How to remove an empty string from a list of empty strings in C#?
- Check if a list is not empty in MongoDB?
- How to initialize an empty array list in Kotlin?
- How do you create an empty list in Java?
- Python | Remove empty tuples from a list
- List of non-empty tables in all your MySQL databases?
- How to check if a list is empty in Python?
- From a list of IDs with empty and non-empty values, retrieve specific ID records in JavaScript
- How to check if a C# list is empty?

Advertisements