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
Solved

Returning collection in C#

Posted on 2014-03-19
5
174 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 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 63

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 63

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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
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
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

828 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