You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The primary use of an interface sdk is necessarly a Front End, so it does not make sense to use ObservableCollection there.
Moreover, there no streaming is used, so no observable collection will be emitted.
In my humble opinion, being cross-platform is far more important, so my preference goes for the simplest type possible :
( I never found a way to use 'Array', so I defaulted to IEnumerable )
The text was updated successfully, but these errors were encountered:
GFlexi
changed the title
The collection types of the nswag Generator should not be 'ObservableCollection'
The collection types of the nswag Generator should not be 'ObservableCollection' for interfarces
Nov 24, 2022
GFlexi
changed the title
The collection types of the nswag Generator should not be 'ObservableCollection' for interfarces
The collection types of the nswag Generator should not be 'ObservableCollection' for interfaces
Nov 24, 2022
I agree with you @GFlexi about not using ObservableCollection for deserialization of collections.
ObservableCollection emits events when its content changes. It is just less performant.
This is useful for frontend that needs support for dual binding.
Therefore if a developer needs an ObservableCollection he should be responsible for having one.
Under the hood an ObservableCollection is a Collection which uses internally a List<T>.
Going with a List or an Array would be the best choice actually.
If messages/dtos/objects that transit must be considered as immutable then an Array is the preferred choice.
The generated interface.nswag uses 'ObservableCollection' for :
The primary use of an interface sdk is necessarly a Front End, so it does not make sense to use ObservableCollection there.
Moreover, there no streaming is used, so no observable collection will be emitted.
In my humble opinion, being cross-platform is far more important, so my preference goes for the simplest type possible :
( I never found a way to use 'Array', so I defaulted to IEnumerable )
The text was updated successfully, but these errors were encountered: