generic-list Questions

6

Solved

I have a subclass of List<Location> called LocationList. This is a convenient way for us to add other properties (like IsExpanded and such that we can use in the UI. Good enough. But now, we ...
Madonna asked 7/7, 2011 at 4:33

5

Solved

Possible Duplicate: Why does (does it really?) List implement all these interfaces, not just IList? Out of curiosity, what is the reason behind generic List<> implementing non-gene...
Ihram asked 27/5, 2011 at 17:58

1

Solved

I want to be able to serialize/deserialize a generic list what I so far is this public static string ToJson(this object obj, int recursionDepth = 100) { JavaScriptSerializer serializer = new J...
Infidelity asked 26/5, 2011 at 22:35

4

Solved

in what situation will an item in System.Collections.Generic.List not be removed successfully? From http://msdn.microsoft.com/en-us/library/cd666k3e.aspx: true if item is successfully removed; ...
Flotation asked 20/5, 2011 at 10:10

4

Solved

To my personal coding style belongs Enumerable.OfType<T>(). I use it everywhere it makes a little bit of sense. Especially IEnumerable<T> allows mighty linqToObject functionallity. I ha...
Cowbird asked 19/5, 2011 at 18:50

2

Solved

I am sure this is a easy question, but I cannot get it to run: var FMyList: TList<String>; begin FMyList := TList<String>.Create(?????); end; How to insert instead of ????? to inse...
Erg asked 24/4, 2011 at 11:40

3

Solved

I have a generic list of doubles that show on the page like this: 1199.17 1199.17 1161.67 1161.67 1161.67 1161.67 1161.67 1161.67 1161.67 1161.67 1161.67 1161.67 1161.67 1161.67 1161.67 1199.17 1...
Uninterrupted asked 8/3, 2011 at 13:33

2

Solved

Generic list: var elementType1 = typeof (List<A>).GetElementType(); Array: var elementType = typeof (A[]).GetElementType(); Why do I only get the element type of an array? How could I g...
Uropod asked 6/2, 2011 at 13:10

1

Solved

I have a datagridview with its datasource binded to a List(Of T). Now i would like to sort on any of the columns. My code: 'Database access : items = List(BlogPost) dgBlogPosts.DataSource = items...
Irrigation asked 4/2, 2011 at 15:47

2

Solved

Is there a way to create a data template that handles a list of items? I have Contact.Phones (EntityCollection<Phone>) and I want the data template to handle the list - add remove edit etc. ...

6

Solved

I'm loading a List<Image> from a folder of about 250 images. I did a DateTime comparison and it takes a full 11 second to load those 250 images. That's slow as hell, and I'd very much like to...
Synthetic asked 28/10, 2010 at 20:25

4

Solved

First question on Stackoverflow (.Net 2.0): So I am trying to return an XML of a List with the following: public XmlDocument GetEntityXml() { StringWriter stringWriter = new StringWriter(); X...
Casta asked 6/8, 2009 at 8:45

4

Solved

I am confused about the BinarySearch method of List<T> in case when the item does not exist. I've got List<long> theList = {1, 3, 5, ...}. theList.BInarySearch(0) returns 0, and t...
Reconstructionist asked 15/8, 2010 at 9:10

4

Solved

I need something similar to List<String, Int32, Int32>. List only supports one type at a time, and Dictionary only two at a time. Is there a clean way to do something like the above (a multid...
Impertinence asked 8/6, 2010 at 4:48

3

I am planning to create the list once in a static constructor and then have multiple instances of that class read it (and enumerate through it) concurrently without doing any locking. In this arti...
Balduin asked 12/5, 2010 at 21:46

6

Solved

In my generic repository I have below method: public virtual IEnumerable<T> GetAll<T>() where T : class { using (var ctx = new DataContext()) { var table = ctx.GetTable<T>().T...
Exmoor asked 5/5, 2010 at 6:5

5

Solved

As I iterate through a DataTable object, I need to check each of its DataRow objects against the items in a generic string List. I found a blog post using the List's Find method along with a deleg...
Randell asked 24/3, 2010 at 15:49

7

i basically want to know the differences or advantages in using a generic list instead of an array in the below mentioned scenario class Employee { private string _empName; public string ...
Hexachlorophene asked 12/3, 2010 at 6:18

2

Solved

We have a small framework written in C# .Net 2.0 that we want to expose to COM. Problem is, we have some generic classes that would be exposed as the following: interface IOurClass { ReadonlyCol...
Deckle asked 7/12, 2009 at 19:58

2

I am trying to figure out how to check if testInt exists in all Car.SomeID in List So: int testInt = 10; List<Car> myCars = GetCars(); I want to see if there is a match on 10 in any of my...
Koel asked 4/12, 2009 at 16:57

3

Solved

I am trying to create a function that accepts a generic List<T> and iterates the list returning an excel file byte[]. The function needs be able to determine the objects properties. So if i p...
Winnah asked 2/12, 2009 at 6:32

2

Solved

So I just was testing the CLR Profiler from microsoft, and I did a little program that created a List with 1,000,000 doubles in it. I checked the heap, and turns out the List<> size was around 1...
Mimetic asked 2/10, 2009 at 7:51

4

Solved

Working in Visual Studio 2008 (C#)... I use a List collection to store instances of my custom class (Shift). I want to delete a certain shift from the list by using the Remove method. But List.Remo...
Polyzoan asked 16/9, 2009 at 18:4

2

Solved

The generic list class has a .ForEach(Action<T> action) method. Now i've done some simple timings of how they both perform and it seems that the generic ForEach is the poorer performer. The (...
Archimedes asked 23/7, 2009 at 16:35

2

Solved

I have the following Generic List which is populated with a list of string: List<string> mylist =new List<string>(); myList.add("string1"); myList.add("string2"); Say I want to ad...
Homemaking asked 7/6, 2009 at 11:3

© 2022 - 2024 — McMap. All rights reserved.