ilist

Why is there no IArray(T) interface in .NET?

▼魔方 西西 提交于 2019-12-17 16:34:12
问题 Update 2011-Jan-06: Believe it or not, I went ahead and incorporated this interface into an open source library I've started, Tao.NET. I wrote a blog post explaining this library's IArray<T> interface, which not only addresses the issues I originally raised in this question (a year ago?!) but also provides a covariant indexed interface , something that's sorely lacking (in my opinion) in the BCL. Question (in short): I asked why .NET has IList<T> , which implements ICollection<T> and

Report viewer set Parameters iList parameters error

て烟熏妆下的殇ゞ 提交于 2019-12-13 02:53:48
问题 Morning all, Using Visual Studio 2012 Ultimate and C#.NET 4.0. IList<Microsoft.Reporting.WinForms.ReportParameter> param = new List<Microsoft.Reporting.WinForms.ReportParameter>(); param = repsetup.NewReportSetup( txtNewPart.Text.ToString(), txtBatch.Text.ToString(), txtLocation.Text.ToString(), txtWheel.Text.ToString(), txtGear.Text.ToString(), txtLength.Text.ToString(), txtFits.Text.ToString(), txtNewBar.Text.ToString(), txtNewBarNum.Text.ToString(), txtABS.Text.ToString() ); reportViewer1

How To Use VB.NET IList(Of T).Max

此生再无相见时 提交于 2019-12-13 02:32:24
问题 How do I use the IList(Of T).Max function in my example below? Dim myList as IList(Of Integer) For x = 1 to 10 myList.add(x) Next 'Error: 'Max' is not a member of 'System.Collections.Generic.IList(Of Integer)' MsgBox(myList.Max()) 回答1: your code throws a System.NullReferenceException when calling myList.add because it has not been initialized. If you use List instead of IList as shown below it works. Imports System.Collections.Generic Module Module1 Sub Main() Dim myList As New List(Of

How can I send an IList via WCF Service?

六眼飞鱼酱① 提交于 2019-12-11 07:19:07
问题 I want to use NHibernate in my WCF service, How can I send an IList via WCF Service? ---EDIT------- Can I put the IList in an object variable and send it? 回答1: Trying to pass an IList<T> isn't really appropriate for a WCF-based service. WCF talks in terms of data contracts, defining the shape of the data a service or client will expect to send and receive. These contracts have to be concrete enough for serializers to know how to convert them into XML, JSON and other representations. When you

Exposing a List<domain objects> via an IList<interface>

Deadly 提交于 2019-12-11 04:35:21
问题 I have a private member of type List<T> where the T are rich domain objects. The domain in my application contains many methods that expect a T . I want to expose only a public property of type IList<IT> where T : IT . IT has a small footprint which is implemented by a DTO. Since I cannot cast a List<T> to IList<IT> I am resorting to using List<T>.ConvertAll in the property declaration. Is this there a better way to do this? Faster, more elegant? Edit to provide additional detail The T are a

DataGridView filtering

本小妞迷上赌 提交于 2019-12-11 02:16:04
问题 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 simple as setting the bs.Filter property but apparently not. The bs.SupportsFiltering returns false as well. Is this an issue with me using the IList? If so, is there another

C# Beginner: Where has my IList.Where() method gone?

♀尐吖头ヾ 提交于 2019-12-10 18:09:20
问题 I've got another simple one (I think) that's stumping me. I have written a method in one of my controls that gets the latest version of a file in a CMS given it's filename (i.e. regardless of what folder the file resides in). I found it useful enough that I thought I'd chuck it in my CMSToolbox class, but when I do this I can no longer use the Where() method of a FileManager class provided by the CMS (which returns a list). Here's a simplified example of my class: using System; using System

IList.Add() overwriting existing data [duplicate]

柔情痞子 提交于 2019-12-10 14:58:30
问题 This question already has answers here : Why does adding a new value to list<> overwrite previous values in the list<> (2 answers) Closed 6 months ago . I'm facing a problem adding data to an IList but the problem is each time I added data the existing data is overwritten with the current one my code is given below: Test test = new Test(); IList<Test> myList = new List<Test>(); foreach (DataRow dataRow in dataTable.Rows) { test.PatientID = Convert.ToInt64(dataRow.ItemArray[0]); test.LastName

Why does C# array not have Count property? [duplicate]

与世无争的帅哥 提交于 2019-12-08 15:59:14
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: count vs length vs size in a collection Really strange: C# arrays such as the following double[] test = new double[1]; support the Length property to get the size of the array. But arrays also implement an IList interface: IList<double> list = test; However, the IList interface provides also a Count property. How come the array ("test" in this case) doesn't? Edit : Thanks to all of you who pointed out that it is

Two list synchronization

这一生的挚爱 提交于 2019-12-08 04:13:19
问题 I'm doing the synchronization between the two lists. IList<Event> GoogleEvents and Table<myEvent> DB.Events; On google side i'm using this String Summary, String Description, EventDateTime Start, EventDateTime End, Event.RemindersData Reminders; On db side like this my code is like this foreach (myEvent item in DB.Events) { if (item.GoogleID == "" || item.GoogleID == null)// i add event my db { //Add dbEvent to google and save id to googleid column } } foreach (Event item in myGoogleCalendar