AppcompatTextView теперь поддерживает автоматическое изменение размеров, начиная с библиотеки поддержки 26.0. TextView в Android O также работает аналогично. Больше информации можно найти здесь. Простое демо-приложение можно найти здесь здесь .
You generally do not base the name of a class off any interface it implements. (Which one do you choose when there are multiple ones, for a start?) It is quite typical to base it off an inherited class, but more often simply on the purpose of the class, and certainly not the interface. (The interface might be named after the class, if anything.)
Your example is somewhat invalidated by the fact that a well-designed ProductCollection
should implement ICollection
and IEnumerable
while a well-designed ProductList
should implement both those interfaces as well as IList
.
If you look in the BCL of the .NET Framework, you should notice that this is precisely the case. The List
class implements all three interfaces, as does the Collection
class (though note that in the general case a 'collection' need not implement IList
).
Это будет зависеть от контекста, например, это может быть ProductsCatalog
(подразумевая, что IEnumerable
доступен только для чтения).
] В более общем смысле это может быть ProductsView
. Конечно, полученные Продукты
можно изменить, но я считаю, что это "звучит" уместно, тем не менее.
The problem here is that List or Collection impose they behave that way. But IEnumerable is very generic, not only in the C# meaning of generic. Every implementation can be behind it.
Some suggestions:
If you look at the types in the .NET Framework that implements IEnumerable
, I would say that the most common suffix is Collection
, followed by the plural form of what the list contains. Then there are a number of "special cases" (such as Queue
and Stack
). I would personally vote for Collection
as a first-hand choice.
In almost every case I can think of from my own experience, I haven't had to think of a name. The compiler does it for me, because I write an iterator method instead of writing a class by hand. And for the method name, it seems natural to just make it a plural word describing the sequence.
If it only implements IEnumerable
, then I would name it ProductEnumeration
, but I would feel free to name an instance of it products
. On the other hand, I don't recall ever creating a class that only implemented IEnumerable
. Doesn't seem to be much point if you can't add stuff to it and if you can, then I'd derive from one of the collection classes that implements IEnumerable
and inherit that behavior, too.
If I were returning an enumeration of Product entities, I'd simply return it as IEnumerable
without having a special class.
Как kek444 Думаю, мне нужно спросить, что еще он делает? Он реализует IEnumerable <>, но это еще не все, иначе вам не понадобится класс, верно? Это сборник? Преобразует ли одно перечислимое в другое (изменение порядка, выбора, генерации и т. Д.)?
Я бы сказал Коллекция . Он может предложить ReadOnlyCollection или ObservableCollection, но он хорошо описывает класс. В конце концов, это набор продуктов (независимо от типа, лежащего в основе).
Чтобы решить этот и другой вопрос, используйте это;)
http://www.classnamer.com/