How to check a list contains a string or any number followed by that string? I need to add string in a list. While adding it in the list I have to check whether that string is already exists in that list. If so need to insert that string with integer count. That is if name is already exists means it should be inserted as "Name1". If again I am adding Name means it should be inserted as name2. and so on... How can I achieve this?
List<Names> NameList=new List<Names>();
Name name=new Name();
name.Name="Name";
NameList.Add(Name);
Name name1=new Name();
name1.Name="Name";
NameList.Add(Name1);
Name name2=new Name();
name2.Name="Name";
NameList.Add(Name2);
Public class Name
{
string Name {get;set; }
}