473,786 Members | 2,775 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamic string[]

I am told that I can have a dynamic or static string array.

So if I declare

string[] dynamic;

How do I add elements to dynamic and resize it ?


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.752 / Virus Database: 503 - Release Date: 9/3/2004
Jul 21 '05
14 2249
On Sun, 05 Sep 2004 03:43:53 GMT, "Spare Change"
<sp*********@sp am.spam> wrote:
I am told that I can have a dynamic or static string array.

So if I declare

string[] dynamic;

How do I add elements to dynamic and resize it ?


using System.Collecti ons.Specialized ;

....
StringCollectio n sc=new StringCollectio n();
sc.Add(str1);
....
//get a real string[] when done if needed

int len=sc.Count;
string[] strings=new string[len];
sc.CopyTo(strin gs,0);

Austin Ehlers
Jul 21 '05 #11
Scott,

I should avoid writting C# code and not using the IDE.
(I write everything automaticly in a VBNet way)

:-)

Thanks,

Cor
Jul 21 '05 #12
>
I see no evidence, that once declared, that a primitive string[] can be
'ReDim'ed


I hope I am not wrong in this way, however as far as I know are there some
differences between the Array and in C# and VBNet.

In VBNet there is the Redim, however I would only using that when converting
a program from VB6 to VBNet and even than check for it and replace when that
is in it directly for a more dynamic one as I showed in a previous message
in this thread.

Redim seems to be a very performance consuming instruction.

Just my thought,

Cor
Jul 21 '05 #13
That is just mad!

"The Devil" <el******@hadez .nyc.spamo> wrote in message
news:yA******** *********@newsr ead1.news.pas.e arthlink.net...

I went with a resizing routine.

foreach(Match m1 in mc1)
{
temp = new string[i+1];
anchors.CopyTo( temp,0);
temp[i++]=fileName+"#"+m 1.Value.Substri ng(5,m1.Length-5);
anchors=temp;
}
Marijan Tadin wrote:
Try Sytem.Text.Stri ngBuilder

Marijan
"Spare Change" <sp*********@sp am.spam> wrote in message
news:ZX******** *******@newsrea d3.news.pas.ear thlink.net...
I am told that I can have a dynamic or static string array.

So if I declare

string[] dynamic;

How do I add elements to dynamic and resize it ?


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.752 / Virus Database: 503 - Release Date: 9/3/2004


--
incognito http://kentpsychedelic.blogspot.com
new material added 9/5

Jul 21 '05 #14

System.Collecti ons.Specialized .StringCollecti on should do. The interface is
very similar to string[] (except that Length is changed to Count) and you
can do Add()/Remove().

Jarek

"Paul Wardle" <p.******@ntlwo rld.com> wrote in message
news:ue******** ******@TK2MSFTN GP14.phx.gbl...
That is just mad!

"The Devil" <el******@hadez .nyc.spamo> wrote in message
news:yA******** *********@newsr ead1.news.pas.e arthlink.net...

I went with a resizing routine.

foreach(Match m1 in mc1)
{
temp = new string[i+1];
anchors.CopyTo( temp,0);
temp[i++]=fileName+"#"+m 1.Value.Substri ng(5,m1.Length-5); anchors=temp;
}
Marijan Tadin wrote:
Try Sytem.Text.Stri ngBuilder

Marijan
"Spare Change" <sp*********@sp am.spam> wrote in message
news:ZX******** *******@newsrea d3.news.pas.ear thlink.net...
> I am told that I can have a dynamic or static string array.
>
> So if I declare
>
> string[] dynamic;
>
> How do I add elements to dynamic and resize it ?
>
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.752 / Virus Database: 503 - Release Date: 9/3/2004
>
>


--
incognito http://kentpsychedelic.blogspot.com
new material added 9/5


Jul 21 '05 #15

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

Similar topics

0
3517
by: starace | last post by:
I have designed a form that has 5 different list boxes where the selections within each are used as criteria in building a dynamic query. Some boxes are set for multiple selections but these list boxes do not necessarily need to have a selection made to be used in the dynamic query. In essence the form can have selections made in all or none of its list boxes to form the dynamic query I am looking to get some feedback in reference to...
6
2983
by: Materialised | last post by:
Hi Everyone, I apologise if this is covered in the FAQ, I did look, but nothing actually stood out to me as being relative to my subject. I want to create a 2 dimensional array, a 'array of strings'. I already know that no individual string will be longer than 50 characters. I just don't know before run time how many elements of the array will be needed. I have heard it is possible to dynamically allocate memory for a 2
5
3760
by: swarsa | last post by:
Hi All, I realize this is not a Palm OS development forum, however, even though my question is about a Palm C program I'm writing, I believe the topics are relevant here. This is because I believe the problem centers around my handling of strings, arrays, pointers and dynamic memory allocation. Here is the problem I'm trying to solve: I want to fill a list box with a list of Project Names from a database (in Palm this is more...
3
1312
by: Stephen Gennard | last post by:
Hello, I having a problem dynamically invoking a static method that takes a reference to a SByte*. If I do it directly it works just fine. Anyone any ideas why? I have include a example below... --
10
34106
by: Spare Change | last post by:
I am told that I can have a dynamic or static string array. So if I declare string dynamic; How do I add elements to dynamic and resize it ?
7
22498
by: Mike Livenspargar | last post by:
We have an application converted from v1.1 Framework to v2.0. The executable references a class library which in turn has a web reference. The web reference 'URL Behavior' is set to dynamic. We added an entry to the executable's .exe.config file to specify the URL, and under the 1.1 framework this worked well. Unfortunately, this is not working under the 2.0 framework. I see in the Reference.cs file under the web service reference the...
2
3639
by: Luis Arvayo | last post by:
Hi, In c#, I need to dynamically create types at runtime that will consist of the following: - inherits from a given interface - will have a constructor with an int argument
0
3501
by: MaryamSh | last post by:
Create Dynamic Dropdownlist Controls and related event -------------------------------------------------------------------------------- Hi, I am creating a Dynamic Search in my application. I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove) By pressing Add button ,another row will be created with the same control (I mean another dropdown and 2 button) and so on. and by...
2
5036
by: englishman69 | last post by:
Hello, I have been banging my head against this one for a while... Searches online have revealed many different proposals for correcting my issue but none that I can follow! My basic situation is this, I have a page which uses multiple postbacks to generate a list of dynamic text boxes with appropriate labels. However, when I do the final postback to enter the values in the dynamic textboxes into the database the values seem to become...
0
9650
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10164
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8992
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6748
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.