- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Null List in C#
A null list exists in C#. To check whether a list is null or not, check them against the null literal. Set a null like this −
List<string> myList = null;
Now, to check for null, use the equality operator −
myList == null;
The following is an example −
Example
using System; using System.Collections.Generic; using System.Linq; public class Demo { public static void Main() { List<string> myList = null; // checking for null Console.WriteLine(myList == null); } }
Output
True
Advertisements