473,397 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

file list and generics

Hi,
Why can't his work

Private Function GetFiles(ByVal sPath As String) As Generic.List(Of String)
Dim f() As String = Directory.GetFiles(sPath)
Return f()
End Function

Should I just create a File Class object, add to it's collection and then
return?

Thanks
Jun 15 '07 #1
1 988
So you want it as a List(of String)?

If so then convert the array to a List(of String):

Private Function GetFiles(ByVal sPath As String) As List(Of String)

Dim f() As String = Directory.GetFiles(sPath)

Return New List(Of String)(f)

End Function

or, more simply:

Private Function GetFiles(ByVal sPath As String) As List(Of String)

Return New List(Of String)(Directory.GetFiles(sPath))

End Function
"Chris" <Ch***@discussions.microsoft.comwrote in message
news:53**********************************@microsof t.com...
Hi,
Why can't his work

Private Function GetFiles(ByVal sPath As String) As Generic.List(Of
String)
Dim f() As String = Directory.GetFiles(sPath)
Return f()
End Function

Should I just create a File Class object, add to it's collection and then
return?

Thanks
Jun 15 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Michael Rockwell | last post by:
I am using a generics List<MyStructure> object of a structure of information I need in my application. Initially I created a predicate to retrieve the correct struct of data, but I am finding that...
5
by: Jimp | last post by:
Why can't I cast List<MyObject> to ICollection<IMyObject>. MyObject implements IMyObject, and of course, List implements ICollection. Thanks
4
by: Cedric Rogers | last post by:
I wasn't sure if I could do this. I believe I am stretching the capability of what generics can do for me but here goes. I have a generic delegate defined as public delegate bool...
5
by: Macca | last post by:
Hi, I have a number of objects i would like to store in a list like struture. They already have ID's associated with them so i would like to utilise these ids as accessors the list.. At the...
2
by: Joe | last post by:
Hi I have a Generics List in a PropertyGrid I am able to Serialize it to XML but when I try to deserialize back to the class of the PropertyGrid The Constructor doesn't seem to fire to reload...
8
by: Nip | last post by:
Hi I want to access the Generic List of the following c++-class inside a vb.net app. Is this possible/how can I do that? Atm, I get the following error in the vb.net app: "Field 'GeoElems' is of...
9
by: Stephan Steiner | last post by:
Hi I seem to have a bit of trouble understanding one bit of how generics work: In C#, every class automatically derives from object, and inherits a bunch of properties (i.e. ToString()). Thus,...
1
by: tshad | last post by:
I have the following code: *************************************** public class Test { .... public static TestCollection MyNewCollection() { } }
7
by: =?Utf-8?B?TXJOb2JvZHk=?= | last post by:
Say I have a class that has a generics List as follows: public List<MyClassmyClassList = new List<MyClass>(); and I want to create another class which tries to add an element of MyClass to...
11
by: Scott Stark | last post by:
Hello, The code below represents a singly-linked list that accepts any type of object. You can see I'm represting the Data variable a System.Object. How would I update this code to use...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.