Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
900
ValueListItemsCollection.AddRange and Null value
posted

Hi,

the AddRange method does not allow to add a ValueItem with DataValue=null to the collection.
see following example:

ValueList list1 = new ValueList();
list1.ValueListItems.Add(null, null);
list1.ValueListItems.Add("one", "one");
object val1 = list1.ValueListItems[0].DataValue;

ValueList list2 = new ValueList();
ValueListItem[] items = new ValueListItem[2];
items[0] = new ValueListItem(null, null);
i
tems[1] = new ValueListItem("one", "one");
list2.ValueListItems.AddRange(items);
object val2 = list2.ValueListItems[0].DataValue;

val1 = null   is OK
val2 = "ValueListItem0" is a Bug