Solved

C# IList conversion from VB

Posted on 2011-09-16
5
365 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
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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

867 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

19 Experts available now in Live!

Get 1:1 Help Now