ArrayList.Contains() isn't bool?
-
Just saw this legacy gem
if(myArrayList.Contains(something)==true || myArrayList.Count>0)
{
if(myArrayList.Contains(something)==false)
{
default=something;
}
else
{
default=myArrayList[0];
}
}this is for C#.net.
-
Just saw this legacy gem
if(myArrayList.Contains(something)==true || myArrayList.Count>0)
{
if(myArrayList.Contains(something)==false)
{
default=something;
}
else
{
default=myArrayList[0];
}
}this is for C#.net.
-
"virtual bool" so anyone can override to make it float. :-D :thumbsup:
-
"virtual bool" so anyone can override to make it float. :-D :thumbsup:
Well, you wouldn't want it to sink, would you? :laugh:
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
-
Just saw this legacy gem
if(myArrayList.Contains(something)==true || myArrayList.Count>0)
{
if(myArrayList.Contains(something)==false)
{
default=something;
}
else
{
default=myArrayList[0];
}
}this is for C#.net.
I love how the first Contains is redundant and the default does not get set if myArrayList is empty.
-
I love how the first Contains is redundant and the default does not get set if myArrayList is empty.
Still worse: when the array list does not contain "something", the default is set to something. When the array list contains something, the default is set to the first element of the array list, which may or may not be "something"...