View Single Post
  #1 (permalink)  
Old 10-26-2004
teayu teayu is offline
Registered User
 
 
Join Date: Oct 2004
Posts: 4
problem in mapping string->string[] in C#

Hi guys,

I tried to generate a C# dictionaryBase impl which names stringArrayMap that maps string->string[], however, the generated code couldn't be compiled:

-----
public override bool Equals(object other)
{
if(object.ReferenceEquals(this, other))
{
return true;
}
if(!(other is StringArrayMap))
{
return false;
}
if(Count != ((StringArrayMap)other).Count)
{
return false;
}
string[] __klhs = new string[Count];
Keys.CopyTo(__klhs, 0);
_System.Array.Sort(__klhs);
string[] __krhs = new string[((StringArrayMap)other).Count];
((StringArrayMap)other).Keys.CopyTo(__krhs, 0);
_System.Array.Sort(__krhs);
for(int i = 0; i < Count; ++i)
{
if(!__klhs[i].Equals(__krhs[i]))
{
return false;
}
}
string[][] __vlhs = new string[][Count];
Values.CopyTo(__vlhs, 0);
_System.Array.Sort(__vlhs);
string[][] __vrhs = new string[][((StringArrayMap)other).Count];
((StringArrayMap)other).Values.CopyTo(__vrhs, 0);
_System.Array.Sort(__vrhs);
for(int i = 0; i < Count; ++i)
{
if(__vlhs[i] == null && __vrhs[i] != null)
{
return false;
}
if(!__vlhs[i].Equals(__vrhs[i]))
{
return false;
}
}
return true;
}
-----
the problem lies in:
string[][] __vlhs = new string[][Count];

do I have to turn to string->collection to get around that? Thanks!

Tea
Reply With Quote