Solved

C# IList conversion from VB

Posted on 2011-09-16
5
362 Views
Last Modified: 2012-05-12
I am trying to conver my vb code below to C#. But I get the error "Using the gerneric type system.collections.generic.IList<T> requires 1 type arguments" where the iList is declared in the declaration.

Would be grateful for any help.

Thanks

Public Function CreateGrid(ByVal id As String,
                   ByVal allowGrouping As Boolean,
                   ByVal allowFiltering As Boolean,
                   ByVal showFooter As Boolean,
                   ByVal allowAddingRecords As Boolean,
                   ByVal autoGenerateColumns As Boolean,
                   ByVal pageSize As Integer,
                   ByVal showHeader As Boolean,
                   ByVal dataSource As IList) As Grid

C# Conversion.......

public Grid CreateGrid(string id, bool allowGrouping, bool allowFiltering, bool showFooter, bool allowAddingRecords, bool autoGenerateColumns, int pageSize, bool showHeader, IList dataSource)
0
Comment
Question by:Soluga
  • 3
  • 2
5 Comments
 
LVL 28

Expert Comment

by:strickdd
Comment Utility
This is it without knowing your data type:

public Grid CreateGrid(string id, bool allowGrouping, bool allowFiltering, bool showFooter, bool allowAddingRecords, bool autoGenerateColumns, int pageSize, bool showHeader, IList<DATATYPEHERE> dataSource) 

Open in new window


This is it assuming your data type:

public Grid CreateGrid(string id, bool allowGrouping, bool allowFiltering, bool showFooter, bool allowAddingRecords, bool autoGenerateColumns, int pageSize, bool showHeader, IList<ObjectDataSource> dataSource) 

Open in new window

0
 
LVL 1

Author Comment

by:Soluga
Comment Utility
My datasource is a generic list!
0
 
LVL 1

Author Comment

by:Soluga
Comment Utility
Would this work...

using System.Collections;

          public Grid CreateGrid(string id, bool allowGrouping, bool allowFiltering, bool showFooter, bool allowAddingRecords, bool autoGenerateColumns, int pageSize, bool showHeader, IList<ICollection> dataSource)
0
 
LVL 28

Accepted Solution

by:
strickdd earned 500 total points
Comment Utility
Ok, sorry for the misunderstanding... to pass a generic list as a parameter you can do this:

public Grid CreateGrid<T>(string id, bool allowGrouping, bool allowFiltering, bool showFooter, bool allowAddingRecords, bool autoGenerateColumns, int pageSize, bool showHeader, IList<T> dataSource)

Open in new window

0
 
LVL 1

Author Closing Comment

by:Soluga
Comment Utility
OK,
Thats great thanks.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now