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 14 2184
You can't - check out ArrayList.
--
Adam Clauss ca*****@tamu.edu
"Spare Change" <sp*********@spam.spam> wrote in message news:ZX***************@newsread3.news.pas.earthlin k.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
Try Sytem.Text.StringBuilder
Marijan
"Spare Change" <sp*********@spam.spam> wrote in message
news:ZX***************@newsread3.news.pas.earthlin k.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
I went with a resizing routine.
foreach(Match m1 in mc1)
{
temp = new string[i+1];
anchors.CopyTo(temp,0);
temp[i++]=fileName+"#"+m1.Value.Substring(5,m1.Length-5);
anchors=temp;
}
Marijan Tadin wrote: Try Sytem.Text.StringBuilder
Marijan
"Spare Change" <sp*********@spam.spam> wrote in message news:ZX***************@newsread3.news.pas.earthlin k.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
Spare,
You declare a "static" string as
string[10] dynamic;
A nice string with a fixed lenght with the name dynamic.
For dynamic array typen check all the iList collections (from which is the
fixex lenght array one) http://msdn.microsoft.com/library/de...classtopic.asp
For even more have a look at the link iCollection on that bottom of that
page
I hope this helps?
Cor
Hi Cor:
Just to avoid confusion: You declare a "static" string as
string[10] dynamic;
The above would lead to a compiler error.
This:
string[] dynamic = new string[10];
Would create a single dimensional array of string types.
--
Scott http://www.OdeToCode.com
On Sun, 5 Sep 2004 12:12:34 +0200, "Cor Ligthert"
<no**********@planet.nl> wrote:
Spare,
You declare a "static" string as
string[10] dynamic;
A nice string with a fixed lenght with the name dynamic.
For dynamic array typen check all the iList collections (from which is the fixex lenght array one) http://msdn.microsoft.com/library/de...classtopic.asp
For even more have a look at the link iCollection on that bottom of that page
I hope this helps?
Cor
On Sun, 05 Sep 2004 03:43:53 GMT, "Spare Change"
<sp*********@spam.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.Collections.Specialized;
....
StringCollection sc=new StringCollection();
sc.Add(str1);
....
//get a real string[] when done if needed
int len=sc.Count;
string[] strings=new string[len];
sc.CopyTo(strings,0);
Austin Ehlers
Yes, you are quite right.
But, I read that string[] can be dynamic.
I see no evidence, that once declared, that a primitive string[] can be
'ReDim'ed
:D
Scott Allen wrote: Hi Cor:
Just to avoid confusion:
You declare a "static" string as
string[10] dynamic;
The above would lead to a compiler error.
This:
string[] dynamic = new string[10];
Would create a single dimensional array of string types.
-- Scott http://www.OdeToCode.com
On Sun, 5 Sep 2004 12:12:34 +0200, "Cor Ligthert" <no**********@planet.nl> wrote:
Spare,
You declare a "static" string as
string[10] dynamic;
A nice string with a fixed lenght with the name dynamic.
For dynamic array typen check all the iList collections (from which is the fixex lenght array one) http://msdn.microsoft.com/library/de...classtopic.asp
For even more have a look at the link iCollection on that bottom of that page
I hope this helps?
Cor
I don't know of any way in c# to implicitly resize a string array.
Consider using System.Collections.Speciallized.StringCollecion class.
It's a strongly-typed collection, something like an array list, but
for strings, so there is no performance hit for boxing.
Hi Cor:
Just to avoid confusion: You declare a "static" string as
string[10] dynamic;
The above would lead to a compiler error.
This:
string[] dynamic = new string[10];
Would create a single dimensional array of string types.
--
Scott http://www.OdeToCode.com
On Sun, 5 Sep 2004 12:12:34 +0200, "Cor Ligthert"
<no**********@planet.nl> wrote:
Spare,
You declare a "static" string as
string[10] dynamic;
A nice string with a fixed lenght with the name dynamic.
For dynamic array typen check all the iList collections (from which is the fixex lenght array one) http://msdn.microsoft.com/library/de...classtopic.asp
For even more have a look at the link iCollection on that bottom of that page
I hope this helps?
Cor
On Sun, 05 Sep 2004 03:43:53 GMT, "Spare Change"
<sp*********@spam.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.Collections.Specialized;
....
StringCollection sc=new StringCollection();
sc.Add(str1);
....
//get a real string[] when done if needed
int len=sc.Count;
string[] strings=new string[len];
sc.CopyTo(strings,0);
Austin Ehlers
Scott,
I should avoid writting C# code and not using the IDE.
(I write everything automaticly in a VBNet way)
:-)
Thanks,
Cor
> 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
That is just mad!
"The Devil" <el******@hadez.nyc.spamo> wrote in message
news:yA*****************@newsread1.news.pas.earthl ink.net... I went with a resizing routine.
foreach(Match m1 in mc1) { temp = new string[i+1]; anchors.CopyTo(temp,0); temp[i++]=fileName+"#"+m1.Value.Substring(5,m1.Length-5); anchors=temp; }
Marijan Tadin wrote:
Try Sytem.Text.StringBuilder
Marijan
"Spare Change" <sp*********@spam.spam> wrote in message news:ZX***************@newsread3.news.pas.earthlin k.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
System.Collections.Specialized.StringCollection 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.******@ntlworld.com> wrote in message
news:ue**************@TK2MSFTNGP14.phx.gbl... That is just mad!
"The Devil" <el******@hadez.nyc.spamo> wrote in message news:yA*****************@newsread1.news.pas.earthl ink.net... I went with a resizing routine.
foreach(Match m1 in mc1) { temp = new string[i+1]; anchors.CopyTo(temp,0);
temp[i++]=fileName+"#"+m1.Value.Substring(5,m1.Length-5); anchors=temp; }
Marijan Tadin wrote:
Try Sytem.Text.StringBuilder
Marijan
"Spare Change" <sp*********@spam.spam> wrote in message news:ZX***************@newsread3.news.pas.earthlin k.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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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 ?
|
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...
|
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
|
by: MaryamSh |
last post by:
Create Dynamic Dropdownlist Controls and related event
--------------------------------------------------------------------------------
Hi,
I am creating a Dynamic Search in my application.
I...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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,...
|
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: 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...
|
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...
|
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,...
| |