I have text boxes and I get and set its input to the structure which is as follow.
public struct mappingData
{
public string a;
public string b;
public int c;
}
mappingData mappingFileData;
public List<mappingData> mappingDatabase = new List<mappingData>();`
once the button is clicked I store it into List
private void btnAddMapData_Click(object sender, EventArgs e)
{
mappingFileData.a = addressPrefixMbDataType[cbMbDataType.SelectedIndex];
mappingFileData.b = addressPrefixMbValue[cbMbValue.SelectedIndex];
mappingFileData.c = Int32.Parse(tbAddress.Text);
// Add new entry to the linked list each time when 'btnAddMapData' is clicked
mappingDatabase.Add(mappingFileData);
}
Now my database can be follows
a , x , 1
a , x , 2
b , x , 1
b , x , 2
but it should not be like as follows
a , x , 1
a , x , 1 > duplicate beacause already "1" is available previously
b , x , 2
b , x , 2 > duplicate beacause already "2" is available previously
b , x , 1 > not a duplicate because 1st parameter is different that is 'b' so "a" and "b" both can hold 1 since both are different and but if there is two "a" in the list then there should be only one "1".
Someone, please suggest me an idea