Click here to Skip to main content
15,921,606 members
Home / Discussions / C#
   

C#

 
GeneralRe: Replace "inner list" of a generic class inheriting from List<T> ? Pin
PIEBALDconsult12-Dec-09 9:49
mvePIEBALDconsult12-Dec-09 9:49 
AnswerRe: Replace "inner list" of a generic class inheriting from List<T> ? Pin
DaveyM6912-Dec-09 7:44
professionalDaveyM6912-Dec-09 7:44 
GeneralRe: Replace "inner list" of a generic class inheriting from List<T> ? Pin
BillWoodruff12-Dec-09 8:30
professionalBillWoodruff12-Dec-09 8:30 
GeneralRe: Replace "inner list" of a generic class inheriting from List<T> ? Pin
PIEBALDconsult12-Dec-09 9:06
mvePIEBALDconsult12-Dec-09 9:06 
GeneralRe: Replace "inner list" of a generic class inheriting from List<T> ? Pin
Gideon Engelberth12-Dec-09 10:56
Gideon Engelberth12-Dec-09 10:56 
GeneralRe: Replace "inner list" of a generic class inheriting from List<T> ? Pin
BillWoodruff13-Dec-09 12:28
professionalBillWoodruff13-Dec-09 12:28 
AnswerRe: Replace "inner list" of a generic class inheriting from List<T> ? Pin
Nicholas Butler12-Dec-09 23:28
sitebuilderNicholas Butler12-Dec-09 23:28 
GeneralRe: Replace "inner list" of a generic class inheriting from List<T> ? Pin
BillWoodruff13-Dec-09 12:21
professionalBillWoodruff13-Dec-09 12:21 
Thanks, Nick, for your reply.

The entire point of my using a generic class that inherited from List<t> was to avoid having to implement List methods and properties.

The first example of 'anyDamnList<t> ... which inherits from List<t> ... I presented does "behave" exactly as you would expect a List<t> to behave : once you have created an instance of it :

A definition as simple as this :

public class anyDamnList<T> : List<T> {}

And a use case as simple as this :

anyDamnList<int> myIntList = new anyDamnList<int> { 12, 21, 32 };

Then just type in 'myIntList in VS code followed by the dot : IntelliSense will show you all the "regular" properties you would expect to see for any List<int> : .Count, etc. methods like .Clear(), .AddRange(), .GetRange() ... and of course all the Linq extension methods are there too ... over 50 of them ! ...

... in this case there's no need to use Ilist. Your use of IList is, of course, appropriate for other types of solutions.

imho the one "mising part of the picture" ... and my motivation for posting this post ... was to address the issue of an alternative way to assign the effective internal List<int> "embodied" in the instance rather than use the (to me tedious) call to Clear() followed by a call to 'AddRange().

You wrote : "LINQ won't help either. LINQ mostly knows about interfaces: IEnumerable and IQueryable; and a little about List and Array. It knows nothing about anyDamnList."

imho you are really short-changing the functionality of Linq with this statement. Many of the over 50 Linq extension methods exposed for List<int>, or similar, are effectively methods, methods that have side-effects, methods that transform from type to type, methods that test and return a bool result. Suggest you get Skeet's book "C# in Depth," and prepare to have your "mind blown" about what Linq can do.

best, Bill

"Many : not conversant with mathematical studies, imagine that because it [the Analytical Engine] is to give results in numerical notation, its processes must consequently be arithmetical, numerical, rather than algebraical and analytical. This is an error. The engine can arrange and combine numerical quantities as if they were letters or any other general symbols; and it fact it might bring out its results in algebraical notation, were provisions made accordingly." Ada, Countess Lovelace, 1844

GeneralRe: Replace "inner list" of a generic class inheriting from List&lt;T&gt; ? Pin
Nicholas Butler13-Dec-09 22:45
sitebuilderNicholas Butler13-Dec-09 22:45 
GeneralRe: Replace "inner list" of a generic class inheriting from List&lt;T&gt; ? [modified] Pin
BillWoodruff14-Dec-09 4:50
professionalBillWoodruff14-Dec-09 4:50 
Answera "partial solution" to : re : Replace "inner list" of a generic class inheriting from List&lt;T&gt; ? Pin
BillWoodruff13-Dec-09 12:51
professionalBillWoodruff13-Dec-09 12:51 
QuestionUsing Methods within a Switch Case Pin
DevonDaDude11-Dec-09 22:47
DevonDaDude11-Dec-09 22:47 
AnswerRe: Using Methods within a Switch Case Pin
Abhinav S11-Dec-09 22:56
Abhinav S11-Dec-09 22:56 
GeneralRe: Using Methods within a Switch Case Pin
OriginalGriff11-Dec-09 23:03
mveOriginalGriff11-Dec-09 23:03 
GeneralRe: Using Methods within a Switch Case Pin
Abhinav S11-Dec-09 23:09
Abhinav S11-Dec-09 23:09 
GeneralRe: Using Methods within a Switch Case Pin
Saksida Bojan12-Dec-09 1:49
Saksida Bojan12-Dec-09 1:49 
GeneralRe: Using Methods within a Switch Case Pin
Richard MacCutchan12-Dec-09 3:08
mveRichard MacCutchan12-Dec-09 3:08 
GeneralRe: Using Methods within a Switch Case Pin
DevonDaDude15-Dec-09 18:20
DevonDaDude15-Dec-09 18:20 
AnswerRe: Using Methods within a Switch Case Pin
OriginalGriff11-Dec-09 23:01
mveOriginalGriff11-Dec-09 23:01 
AnswerRe: Using Methods within a Switch Case Pin
PIEBALDconsult12-Dec-09 3:59
mvePIEBALDconsult12-Dec-09 3:59 
GeneralRe: Using Methods within a Switch Case Pin
DevonDaDude12-Dec-09 15:45
DevonDaDude12-Dec-09 15:45 
QuestionUse of &lt;&lt; and &gt;&gt; [modified] Pin
Joe Rozario11-Dec-09 19:16
Joe Rozario11-Dec-09 19:16 
AnswerRe: Use of &lt;&lt; and &gt;&gt; Pin
Abhinav S11-Dec-09 19:56
Abhinav S11-Dec-09 19:56 
AnswerRe: Use of &lt;&lt; and &gt;&gt; [modified] Pin
DaveyM6911-Dec-09 21:27
professionalDaveyM6911-Dec-09 21:27 
GeneralRe: Use of &lt;&lt; and &gt;&gt; Pin
Joe Rozario11-Dec-09 21:46
Joe Rozario11-Dec-09 21:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.