0
Reply

array3.sortedlist' does not contain a definition for 'add',ContainsKey,GetByIndex,ndexOfKey

Ask a question
nidheesh n

nidheesh n

14y
4.1k
1

using
System;
using
System.Collections.Generic;
using
System.Text;
using
System.Collections;
 

namespace
array3
{
class car
{
private string carmodel;
private string carname;
public string Model
{
get
{
return carmodel;
}
}
public string name
{
get
{
return carname;
}
}
public car( string carmodel,string carname)
{
this.carmodel=carmodel;
this.carname=carname;
}
}
class sortedlist
{
static void Main(string[] args)
{
sortedlist objcar = new sortedlist();
objcar .add(
"1991", "hyundai");
objcar.Add(
"1992","bmw");
Console.WriteLine ("enter model no");
string model=Console .ReadLine();
if(objcar.ContainsKey(model))
{


car objcar2=(car)objcar.GetByIndex(objcar.IndexOfKey(model));
Console.WriteLine ("car name={0}",objcar2.name);
}
else
{
Console.WriteLine ("not found");
}
}
 

}
}

Attachment: array3.rar