Синтаксис:
Используется csharp
using System;
using System.Collections;
public class AssocArray
{
ArrayList a = new ArrayList();
ArrayList k = new ArrayList();
int lastnum = 0;
public AssocArray()
{
}
public int Length
{
get
{
return this.lastnum;
}
}
public object this[string index]
{
get
{
int i = this.k.IndexOf(index);
if (i<0)
return null;
else
return (object)this.a[i];
}
set
{
int i = this.k.IndexOf(index);
if (i>=0)
{
this.a.Insert(i, value);
this.k.Insert(i, index);
}
else
{
this.a.Add(value);
this.k.Add(index);
this.lastnum++;
}
}
}
}
using System.Collections;
public class AssocArray
{
ArrayList a = new ArrayList();
ArrayList k = new ArrayList();
int lastnum = 0;
public AssocArray()
{
}
public int Length
{
get
{
return this.lastnum;
}
}
public object this[string index]
{
get
{
int i = this.k.IndexOf(index);
if (i<0)
return null;
else
return (object)this.a[i];
}
set
{
int i = this.k.IndexOf(index);
if (i>=0)
{
this.a.Insert(i, value);
this.k.Insert(i, index);
}
else
{
this.a.Add(value);
this.k.Add(index);
this.lastnum++;
}
}
}
}