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

x
?
Solved

Returning collection in C#

Posted on 2014-03-19
5
Medium Priority
?
188 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
[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
5 Comments
 
LVL 143

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 64

Accepted Solution

by:
Fernando Soto earned 2000 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 64

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
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…

610 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