Solved

Returning collection in C#

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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

691 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