Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

C# IList conversion from VB

Posted on 2011-09-16
5
Medium Priority
?
378 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 28

Expert Comment

by:strickdd
ID: 36549221
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
ID: 36549234
My datasource is a generic list!
0
 
LVL 1

Author Comment

by:Soluga
ID: 36549254
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 2000 total points
ID: 36549261
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
ID: 36549440
OK,
Thats great thanks.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

618 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