473,385 Members | 1,838 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,385 software developers and data experts.

What to use for file contents....

hi everyone,

i have a minor prob and am not sure how to solve this.

What are we coming from?
Well, there are several template files inside a folder. these template
files have different names, like "DBCommonManager.cs" or
"%TABLE%EntityTable.cs", where "%TABLE%" is replaced during the work
with the file. Inside the the files, we have C# source code in which
we have to replace certain parts with variable contents.

What do we want to do?
We want to load the filenames dynamically into an ArrayList. For this
we have a DirectoryInfo object. Here's the source:

public ArrayList GetFilenames(string startpath){
try{
mPath = startpath + "/dsfiles/";
DirectoryInfo Sources = new DirectoryInfo(mPath);
ICollection ExistingFileNames = Sources.GetFiles();
mFileNames.AddRange(ExistingFileNames);
return mFileNames;
} catch (Exception e){
throw new Exception(e.Message);
}
}

Now we want to load the files contents into something. ;)
And here is my problem, i don't know what to load those contents into.
Best would be somekind of multidimensional array. But since it is not
easy to change an arrays size in runtime, i'm not sure if this is such
a good idea after all, because i have no clue, how many lines these
files contain. And since i need one element per line, i don't want to
size the arrays to 20000 in the beginning.

If anyone has any suggestions, i would be very thankfull!

Yours,
Denis
Nov 15 '05 #1
1 1208
On 2 Sep 2003 07:32:51 -0700, de*********@bat.com (Denis Briel) wrote:
Now we want to load the files contents into something. ;)
And here is my problem, i don't know what to load those contents into.
Best would be somekind of multidimensional array. But since it is not
easy to change an arrays size in runtime, i'm not sure if this is such
a good idea after all, because i have no clue, how many lines these
files contain. And since i need one element per line, i don't want to
size the arrays to 20000 in the beginning.


Is the System.Collections.Specialized.StringCollection internally also
an array or a linked list?
If it is a linked list I would advise you to use that one! LL's have
less performance issues with adding/removing elements than resizing
arrays has.

--
NULL
Nov 15 '05 #2

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

Similar topics

6
by: Foxy Kav | last post by:
Hi, another question from me again, i was just wondering if anyone could give me a quick example of reading data from a file then placing the data into an array for some manipulation then reading...
3
by: I_AM_DON_AND_YOU? | last post by:
In my program I am using the notepad file to read/write data. I don't want that someone should be able to delete/change the contents of that file by opening that file in Notepad or other editor. ...
8
by: david.lindsay.green | last post by:
Hello all, I am quite new a web scripting and making web pages in general and I have stumbled across a problem I have as yet been unable to solve. I am trying to take the contents of a textarea box...
1
by: PTM | last post by:
I have created an xml file using normal file write (was less code than DOM), the layout of which is nice and easy to view both in a text editor (eg, wordpad) and in a browser. eg: <xml header...
15
by: Gan Quan | last post by:
I'm writing a c++ program that has many (100+) threads read/write files simultaneously. It works well if not considering the efficiency. The file i/o seems to be the bottleneck. This is my code...
1
by: snitu | last post by:
hello i am new to using javascript. i have a problem in creating texonomy using xml file in javascript. my xml file is this ________________________________________ <?xml version="1.0"?>...
7
by: snitu | last post by:
hello i am new user of this forum. i have a problem in javascript code. plz. give me idea about how to create tree using xml file (not using xsl file) in javascript. i am also sending my...
3
by: Tinku | last post by:
Dear C++'ers I like to know how we can modify the contents in a file ex: There is a file.txt with the following data Weather=Cold WhatIDo=SleepOntheBed
0
by: programming | last post by:
hi all, here is the php code! i am trying to use to 'edit' hyperlink to edit txt in member.txt. Problem is that it reads the values ok into an array, however when i attempt and update new...
45
by: Dennis | last post by:
Hi, I have a text file that contents a list of email addresses like this: "foo@yahoo.com" "tom@hotmail.com" "jerry@gmail.com" "tommy@apple.com" I like to
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.