If you want to check if the zero'th element of every list is an empty string you could use .All()
:
bool isEmpty = uuu.All(list => list.ColumnValues[0] == "");
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi Folks,
public class RowDefinition
{
public List<string>ColumnValues { get; }
public int Length => ColumnValues.Count;
public RowDefinition( List<string> columnValues)
{
ColumnValues = columnValues;
}
}
I have below list
List<string> obj = new List<string>();
obj.Add("");
obj.Add("");
obj.Add("oop");
List<string> obj1 = new List<string>();
obj1.Add("");
obj1.Add("der");
obj1.Add("oop");
List<string> obj2 = new List<string>();
obj2.Add("");
obj2.Add("der");
obj2.Add("oop");
List<RowDefinition> uuu = new List<RowDefinition>();
uuu.Add(new RowDefinition(obj));
uuu.Add(new RowDefinition(obj1));
uuu.Add(new RowDefinition(obj2));
How can I find if particular index in the list is empty ?
For example if I consider the above table
index[0] is empty as all three list have empty entries at 0 position
If you want to check if the zero'th element of every list is an empty string you could use .All()
:
bool isEmpty = uuu.All(list => list.ColumnValues[0] == "");