Czy jest coś takiego w C#? Nie jestem bardzo pewny:Wiele właściwości indeksu na typie?
class Library
{
public string Books[string title]
{
get{return this.GetBookByName(string title);}
}
public DateTime PublishingDates[string title]
{
get{return this.GetBookByName(string title).PublishingDate;}
}
}
Więc to może być używane jako takie:
myLibrary.Books["V For Vendetta"]
myLibrary.PublishingDates["V For Vendetta"] = ...
Więc moje pełne metody członkowskie, które muszę wdrożyć w moim ramy (przez nazywając je) są:
GetCustomStringValue (key)
GetCustomIntValue (key)
GetCustomBoolValue (key)
GetCustomFloatValue (key)
SetCustomStringValue (key)
SetCustomIntValue (key)
SetCustomBoolValue (key)
SetCustomFloatValue (key)
Chcę zaimplementować je czystsze w moim własnym typie.
Jaki jest tego cel? Dlaczego nie możesz po prostu użyć zwykłych starych, normalnych metod do zdobywania i ustawiania? – Timwi
Po prostu myśl, że ktoś może wymyślić lepsze rozwiązanie. Wydaje się, że nie jest tak elegancko, ale po prostu eksperymenty. –