ilist

Searching for object in IList or IQueryable

Hi There I need to find a match of an item in a IQueryable list. I have a list as follows: IQueryable<EventItem> eventItems = new Queryable<EventItem>(); EventItem eventItem1 = new EventItem("Event 1"); EventItem eventItem2 = new EventItem("Event 2"); eventItems.Add(eventItem1); eventItems.Add(eventItem2); I now want to find the eve...

Problem with custom IComparer for List (sort) - c#

Hi, can anyone help, i have problem doing a sort, I thought i had it sorted but appears not to be working. I have a List which stores the following values 8,6,10,11,7 I also have another List (accessories in my class and it has a propert called accessoryId current the classes are in the order of id which is currenty 6,7,8,10,11) H...

Is Socket.BeginReceive(IList<ArraySegment<byte>> buffers.. Not Asynchronous?

Hi all, I have been looking to implement a custom class of : IList<ArraySegment<byte>> this will be passed to a socket, and used as the buffer to receive data from that Socket. Socket.BeginReceive( IList<ArraySegment<Byte>>, SocketFlags, AsyncCallback, Object ) MSDN Documentation While testing I have found that when calli...

.NET / C# Binding IList<string> to a DataGridView

I have an IList<string> returning from a function (as variable lst) and I set and then I this.dataGridView1.DataSource = lst; The datagrid adds one column labelled Length and then lists the length of each string. How do I make it just list the strings? ...

Why IList<T> does not have Insert methods which take IEnumerable<T>?

I'm in a situation where I just want to append values in string array (type String[]) to an object with IList<String>. A quick look-up on MSDN revealed that IList<T>'s Insert method only has a version which takes an index and an object T, and does not have a version which takes IEnumerable<T> instead of T. Does this mean that I have to...

Implementing IList interface

I am new to generics. I want to implement my own collection by deriving it from IList<T> interface. Can you please provide me some link to a class that implements IList<T> interface or provide me a code that at least implements Add and Remove methods? ...

IList using covariance and contravariance in c#, is this possible?

Hi all would this be possible? (I don't have vs. 2010, so I can't try it myself, sorry) public interface IComplexList<out TOutput, in TInput> where TOutput : TInput { public IEnumerator<TOutput> GetEnumerator(); public void Add(TInput item); } public interface IList<T> : IComplexList<T, T> { } If I get it right, you could us...

Why do arrays support IList?

The IList interface requires an Add method. Arrays implement this function but it simply throws a NotImplementedException. This seems like very bad design to me. What were the designers thinking when they did this? ...

Checking of List equality in C# .Net not working when using Nhibernate

I seem to be having a problem with checking for list equality. In my case, I have two role objects and I want to see if they are equal. Each role contains a name and a List of permissions. Each permission contains just a name. public class Role : BaseDomain { virtual public String Name { get; set; } virtual public IList...

Enumeration of .Net IList

I'd like to know if I can assume that the IEnumerator I get from an IList (by calling the GetEnumerator method from the IEnumerable interface) will give me the items in the order of the list. What do you think? ...

Anyway to make a IList.Contains() act more like a wildcard contains?

Hi there, I am trying to parse thru a csv string, put the results into a IList collection and then trying to find a way to do a wildcard 'contains' based on what was passed in. Right now I have the following: public static IList<string> DBExclusionList { get { Regex splitRx = new Regex(@",\s*", Reg...

Why do ListBox.ObjectCollection and ListView.ListViewItemCollection have AddRange but not InsertRange or RemoveRange?

So, both ListBox.ObjectCollection and ListView.ListViewItemCollection implement the IList class, which provides Add and Remove methods but no AddRange, InsertRange, or RemoveRange. However, ListBox.ObjectCollection and ListView.ListViewItemCollection also provide an AddRange method -- just no InsertRange or RemoveRange. Look at the Arra...

DataGridView filtering

I'm creating a control that should be able to take any kind of list. Essentially the following code: void BindData(IList list) { BindingSource bs = new BindindSource(); bs.DataSource = list; this.DataGridView.DataSource = bs; } Now I have a textbox that I want to use to filter the data in my grid. I figured it'd be as ...

Using a IList, how to populate it via a comma separated list of ID's

I have a property IList CategoryIDs, and a private string variable that contains a comma separated list, how to elegantly populate the IList collection? I asked earler and I learn a neat way of populating the List with .AddRange(...), but now I realized I have to have the property return IList which doesn't seem to support the .AddRange...

Convert a IList<int> collection to a comma separated list

Any elegant ways of converting a IList collection to a string of comma separated id's? "1,234,2,324,324,2" ...

LINQ: help with "contains" and a Lambda query

Hi there, I have a list which contains enums, its a standard Enum but has an attribute attached to it and an extension method which returns a CHAR of the enum (see below - GetCharValue), the extension works great. Now I have (another extension method for linq) public static IQueryable<Building> WithStatus(this IQueryable<Building...

Which Json deserializer renders IList<T> collections?

I'm trying to deserialize json to an object model where the collections are represented as IList<T> types. The actual deserializing is here: JavaScriptSerializer serializer = new JavaScriptSerializer(); return serializer.Deserialize<IList<Contact>>( (new StreamReader(General.GetEmbeddedFile("Contacts.json")).ReadToEnd())); Befor...

Return multiple ilists from a dal function in asp.net vb.net

I modified a function that returns a strongly typed Ilist of products (from a web search form) from a stored procedure. Because of the complexity of the stored procedure I have changed it to return productcategories as well using the product results. I can get this into another strongly typed ilist but for the life of me I cannot return...

Is there a limit of elements that could be stored in a List ?

Is there a limit of elements that could be stored in a List ? or you can just keeping adding elements untill you are out of memory ? ...

generic list question

I have my objects like this. public class BaseTable { public int ID { get; set; } public int ParentID { get; set; } public string Description { get; set; } public bool IsActive { get; set; } } public class CarFuelType : BaseTable { } and a test class public class Test { publi...