Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
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
