Discussion Forum : collections

C# List - Removing items while looping / iterating
Suppose that I have the following code snippet: var data=new List<string>(){One,Two,Three}; for(int i=0 ; i<data.Count  ... View Detail
 Upvotes: 0   Answers: 0
Safely Removing DataRow In ForEach
I don't understand why this code does not work. foreach (DataRow dataRow in dataTable.Rows) {  if (true)  {   dataRow.D ... View Detail
 Upvotes: 0   Answers: 0
Elegant way to combine multiple collections of elements?
Say I have an arbitrary number of collections, each containing objects of the same type (for example, List<int> foo and ... View Detail
 Upvotes: 0   Answers: 0
C# associative array
I've been using a Hashtable, but by nature, hashtables are not ordered, and I need to keep everything in order as I add ... View Detail
 Upvotes: 0   Answers: 0
C# Iterate through NameValueCollection
I have a NameValueCollection, and want to iterate through the values. Currently, I’m doing this, but it seems like ther ... View Detail
 Upvotes: 0   Answers: 0
Auto-initializing C# lists
I am creating a new C# List (List<double>). Is there a way, other than to do a loop over the list, to initialize all the ... View Detail
 Upvotes: 0   Answers: 0
filtering a list using LINQ
i have a list of project objects: IEnumerable<Project> projects  a Project class as a property called Tags. this is a ... View Detail
 Upvotes: 0   Answers: 0
Compare Two Lists Via One Property Using LINQ
Say I have the following:  class Widget1{   public int TypeID { get; set; }   public string Color { get; set; }  }   cl ... View Detail
 Upvotes: 0   Answers: 0
C# object to array
Using reflection I have an object which I need to cast into an iterable list of items (type unknown, will be object). Us ... View Detail
 Upvotes: 0   Answers: 0
Is there a way to get all the querystring name/value pairs into a collection?
Is there a way to get all the querystring name/value pairs into a collection? I'm looking for a built in way in .net, i ... View Detail
 Upvotes: 0   Answers: 0
How do I override List<T>'s Add method in C#?
I am currently looking to make my own collection, which would be just like a regular list, except that it would only hol ... View Detail
 Upvotes: 0   Answers: 0
C#, a String's Split() method
C#, a String's Split() method, how can I put the resulting string[] into an ArrayList or Stack?
 Upvotes: 0   Answers: 0
List vs ArrayList vs Dictionary vs Hashtable vs Stack vs Queue?
We can use any of these (includes List, ArrayList, Dictionary, Hashtable, Stack, Queue) to hold value or hold reference ... View Detail
 Upvotes: 0   Answers: 0
AddRange to a Collection
A coworker asked me today how to add a range to a collection. He has a class that inherits from Collection<T>. There's a ... View Detail
 Upvotes: 0   Answers: 0
.NET - Convert Generic Collection to DataTable
I am trying to convert a generic collection (List) to a DataTable. I found the following code to help me do this: // So ... View Detail
 Upvotes: 0   Answers: 0
What's the best way of implementing a thread-safe Dictionary?
I was able to implement a thread-safe Dictionary in C# by deriving from IDictionary and defining a private SyncRoot obje ... View Detail
 Upvotes: 0   Answers: 0
Convert List<T> to ObservableCollection<T> in WP7
I don't know if it's just too late or what, but I don't see how to do this... What I'm expecting to do, and what the ob ... View Detail
 Upvotes: 0   Answers: 0
C#: Difference between List<T> and Collection<T> (CA1002, Do not expose generic lists)
Tried to run Run Code Analysis on a project here, and got a number of warnings that said something like this: CA1002 ... View Detail
 Upvotes: 0   Answers: 0
Find Item in ObservableCollection without using a loop
Currently i have the following syntax (list is a list containing objects with many different properties (where Title is ... View Detail
 Upvotes: 0   Answers: 0
Find items from a list which exist in another list
I have a List<PropA> PropA   {    int a;    int b;   }  and another List<PropX> PropX   {    int a;    int b;   }  N ... View Detail
 Upvotes: 0   Answers: 0
Recreating a Dictionary from an IEnumerable<KeyValuePair<>>
I have a method that returns an IEnumerable<KeyValuePair<string, ArrayList>>, but some of the callers require the result ... View Detail
 Upvotes: 0   Answers: 0
Collection<T> versus List<T> what should you use on your interfaces?
The code looks like below: namespace Test {  public interface IMyClass  {   List<IMyClass> GetList();  }   public class ... View Detail
 Upvotes: 0   Answers: 0
DataGridView Selected Row Move UP and DOWN
How can I allow selected rows in a DataGridView (DGV) to be moved up or down. I have done this before with a ListView. ... View Detail
 Upvotes: 0   Answers: 0
Convert List<DerivedClass> to List<BaseClass>
While we can inherit from base class/interface, why can't we declare a List<> using same class/interface? interface  ... View Detail
 Upvotes: 0   Answers: 0
How to Quickly Remove Items From a List
I am looking for a way to quickly remove items from a C# List<T>. The documentation states that the List.Remove() and L ... View Detail
 Upvotes: 0   Answers: 0

Quick Links



Total Followers
Study Group Created
Study Group Joined
Following Teacher
Following Organization
Blog Articles Added
Questions Asked
Questions Answered
Jobs Posted
Total Members in Group
Questions asked by members
Tasks added in this Group

Please wait..


Login to Open ESchool OR Create your account    Login   SignUp