How can I declare a sharp list with double values ​​with zero value in C?

The goal is to list and count the number of null values ​​that I have. It will be used to test some Linq code since I don't have a database. The fact is that no matter how I tried to define it, I get from my compiler: “Type or namespace name List1” could not be found. Are you missing the using directive or assembly references? (CS0246)]. "

early.

+5
source share
4 answers

make sure you have:

using System.Collections.Generic;

then it should be as simple as:

List<double?> mylist = new List<double?>();
+10
source

mcs? 1.1. " ". gmcs 2.0.

, using System.Collections.Generic; " "

+2

With John Boker answer, you can do something like the following:

List<double?> mylist = new List<double?>();
int nullItemsCount = mylist.Count(item => !item.HasValue);
+2
source

List<double?> l = new List<double?>();

Works for me ... The (Of T) list, like Nullable (Of T), is in System.Core do you have a link?

0
source

All Articles