R
Robert Linder
I am trying to compare arraylists in csharp.
I setup a simple test with empty arraylists.
string [] x1 = {};
string [] x2 = {};
Console.WriteLine( x1 == x2 ); // false
Console.WriteLine( x1.Equals(x2) ); // false
Console.WriteLine( x1.GetLength(0) == 0 ); // true
What is the way to compare arraylist?
What is the way to check for empty arraylist?
GetLength is bad when there is a large arraylist.
This works, but I prefer something like 'x1.IsEmpty()'
try{Console.WriteLine( x1.GetValue(0) );}
catch( System.IndexOutOfRangeException )
{Console.WriteLine( "Empty Arraylist"); }
Robert
I setup a simple test with empty arraylists.
string [] x1 = {};
string [] x2 = {};
Console.WriteLine( x1 == x2 ); // false
Console.WriteLine( x1.Equals(x2) ); // false
Console.WriteLine( x1.GetLength(0) == 0 ); // true
What is the way to compare arraylist?
What is the way to check for empty arraylist?
GetLength is bad when there is a large arraylist.
This works, but I prefer something like 'x1.IsEmpty()'
try{Console.WriteLine( x1.GetValue(0) );}
catch( System.IndexOutOfRangeException )
{Console.WriteLine( "Empty Arraylist"); }
Robert