Prev: WPF - How can I selectively set the “Border brush” of a customcont
Next: Storing a generic type
From: Arne Vajhøj on 30 Jun 2010 20:31 On 30-06-2010 20:23, Stefan Ram wrote: > Are there any methods in the standard .NET library that have > parameters of an interface type? > > (Preferably, simple methods with only one parametersthat > can be called without many preparations and can be easily > understood by beginners.) System.Collections.Generic.List<> have some methods that take an IComparer<> parameter. But in general .NET does not use as much interfaces as Java. Arne
From: Peter Duniho on 30 Jun 2010 22:19 Stefan Ram wrote: > Are there any methods in the standard .NET library that have > parameters of an interface type? > > (Preferably, simple methods with only one parametersthat > can be called without many preparations and can be easily > understood by beginners.) There are lots. I'd agree it's not quite as broad as what's found in Java. But the collection-oriented types are especially represented in this area (other examples there that come to mind include the ReadOnlyCollection<T> constructor that takes an IList<T>, all of the System.Linq.Enumerable extension methods, which take IEnumerable<T> and other interfaces, of course, certain XML initialization constructors/methods where you can find IXPathNavigator, just to name a few). A lot of the older .NET API seems to rely more on abstract base classes, a la Stream, TextReader, etc. rather than interfaces. Pete
|
Pages: 1 Prev: WPF - How can I selectively set the “Border brush” of a customcont Next: Storing a generic type |