0

Iwant to delete null list items in c#

How can i delete list items that have null value in c#

12th Apr 2017, 4:52 PM
prg_Mohamad
prg_Mohamad - avatar
1 Resposta
0
Here is a simple console applicaion using System; using System.Collections.Generic; namespace SoloLearn { internal static class BinaryToDecimal { private static void Main() { // Create dummy list var nullList = new List<object> {null, 23, "SoloLearn", null}; //Remove null objects using Lambda predicate function nullList.RemoveAll(item => item == null); //Print list objects after filtering foreach (var obj in nullList) { Console.WriteLine("Item:{0}", obj); Console.ReadLine(); } } } }
12th Apr 2017, 6:00 PM
Waleed El-Badry
Waleed El-Badry - avatar