Solved

Returning collection in C#

Posted on 2014-03-19
5
171 Views
Last Modified: 2014-04-16
Hi guys,

what is the equivalent method of the following in C#

Public Function MyFun( ByVal strSqlQuery as string) as collection

Dim abc as Collection

please help

regards,
0
Comment
Question by:shah36
5 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 39939838
sounds like a homework question, so I will guide to the "man pages" first:
http://msdn.microsoft.com/en-us/library/ybcx56wz.aspx

you will see some examples of C# code, which has functions that return some collection-type stuff.
0
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 39939843
Hi shah36;

There is no equivalent type in C# as a Collection but you can use the Visual Basic type by doing the following. Add a Reference to the dll Microsoft.VisualBasic.dll and then add the using statement at the top of the code file, using Microsoft.VisualBasic;. The the code gets translated as follows:
Collection abc = new Collection();

public Collection MyFun( string strSqlQuery )
{

}

Open in new window

0
 

Author Closing Comment

by:shah36
ID: 39939852
Oh thanks a lot. Yes it works. Great stuff

regards
0
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 39939856
Not a problem, glad to help.
0
 
LVL 7

Expert Comment

by:niralshah
ID: 40003733
It is
public Collection MyFun( string strSqlQuery)  
{
     Collection abc = new Collection();
     return abc;
}
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 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

22 Experts available now in Live!

Get 1:1 Help Now