Solved

Returning arraylist from a method

Posted on 2014-03-19
2
216 Views
Last Modified: 2014-03-19
Hi there,

in VB.Net we can write a function which returns arraylist. How we do this in C# as it seems no option to do this. for example i want this to achieve

Public ArrayList MyMethod(string a)
{
}

regards,
0
Comment
Question by:shah36
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 39939229
The below should be perfectly valid.
public ArrayList MethodName(string a)
{
}

Open in new window

You may need to add a using statement for the System.Collections namespace, if you don't have one already, as newer Studios only tend to include the one for generics by default.
using System.Collections;

Open in new window

Or you can use the expanded:
public System.Collections.ArrayList MethodName(string a)
{
}

Open in new window

You may also want to consider using one of the newer Generics (List<> for example) rather than ArrayList.
0
 

Author Closing Comment

by:shah36
ID: 39939232
Ah thanks a lot. yes including the system.collection name space resolved it. Thanks again
regards,
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
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!
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
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…

762 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

18 Experts available now in Live!

Get 1:1 Help Now