hastily implemented indexer and ToString for DatabaseField

This commit is contained in:
Michael Becker 2019-11-15 12:12:49 -05:00
parent 8f797ee03f
commit cdd181bf70
No known key found for this signature in database
GPG Key ID: 389DFF5D73781A12

View File

@ -7,7 +7,6 @@ namespace UniversalEditor.ObjectModels.Database
public class DatabaseFieldCollection
: System.Collections.ObjectModel.Collection<DatabaseField>
{
private System.Collections.Generic.Dictionary<string, DatabaseField> fieldsByName = new System.Collections.Generic.Dictionary<string, DatabaseField>();
public DatabaseField Add(string Name)
{
return Add(Name, String.Empty);
@ -26,7 +25,11 @@ namespace UniversalEditor.ObjectModels.Database
{
get
{
return fieldsByName[Name];
for (int i = 0; i < Count; i++)
{
if (this[i].Name.Equals(Name)) return this[i];
}
return null;
}
}
}
@ -48,6 +51,11 @@ namespace UniversalEditor.ObjectModels.Database
}
return clone;
}
public override string ToString()
{
return String.Format("{0} = {1}", Name, Value);
}
}
}