473,473 Members | 2,148 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Can we join to array into a one

ad
I have two arry with the same type, like

string[] FirstArray={"a", "a", "a"};
string[] FirstArray={"b", "b"};

How can I join these two arrays into one array?
Nov 17 '05 #1
4 13221
i think you have to create a new array, if i remember right you can't
change an array size
Nov 17 '05 #2
There is no predefined way to join two arrays together (that I know
of), because there are several ways you might want to do that. Do you
want:

string[] joined = { "a", "a", "a", "b", "b" };

or

string[][] joined = { new string[] { "a", "a", "a" }, new string[] {
"b", "b" } };

or some other way of joining them?

Nov 17 '05 #3
Bruce Wood wrote:
There is no predefined way to join two arrays together (that I know
of), because there are several ways you might want to do that. Do you
want:

string[] joined = { "a", "a", "a", "b", "b" };

or

string[][] joined = { new string[] { "a", "a", "a" }, new string[] {
"b", "b" } };

or some other way of joining them?


i think he wants the first
Nov 17 '05 #4
You can do the first in three lines:

string[] joinedArray = new string[firstArray.Length +
secondArray.Length];
firstArray.CopyTo(joinedArray, 0);
secondArray.CopyTo(joinedArray, firstArray.Length);

Nov 17 '05 #5

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

Similar topics

16
by: Jim Hefferon | last post by:
Hello, I'm getting an error join-ing strings and wonder if someone can explain why the function is behaving this way? If I .join in a string that contains a high character then I get an ascii...
1
by: Todd Anderson | last post by:
Dear Sirs and or Madaams, I need to write a file from @fields. I need the file to look like... $bgcolor = "black"; $textcolor = "black"; etc... or $bgcolor = "black"; $textcolor = "black"; ...
2
by: Epson Barnett | last post by:
I'm working on learning .NET and I'm curious about the reason for using static methods in some cases. Specifically, the string class has a split and a join method, but only the join method is...
7
by: !TG | last post by:
I recently learned of Join response.write join(ThisArray," ") I am having trouble with it, however and it appears to be caused by null characters. Is there anyway around this join problem...
14
by: Bob | last post by:
I have a function that takes in a list of IDs (hundreds) as input parameter and needs to pass the data to another step as a comma delimited string. The source can easily create this list of IDs in...
2
by: André | last post by:
Hi, I have a two-dimension array with integers and i want to join it into a string. See my code: dim va(10,5) as integer dim mystring as string .... for j=1 to 10 for k=1 to 5 mystring =...
9
by: chadlupkes | last post by:
I'm getting NULLs where there shouldn't be. Any help is appreciated. Here are the tables: precinct Field Type Null Key Default Extra id smallint(6) PRI...
23
by: Summercool | last post by:
i think in Ruby, if you have an array (or list) of integers foo = you can use foo.join(",") to join them into a string "1,2,3" in Python... is the method to use ",".join() ? but then it...
6
by: Matt Mackal | last post by:
I have an application that occassionally is called upon to process strings that are a substantial portion of the size of memory. For various reasons, the resultant strings must fit completely in...
2
by: Bart | last post by:
Hi, i get the error "BC30518:Overload resolution failed because no accessible 'Join' can be called with these arguments" at line: hvd = Join(hvertp, ",") Any idea what's wrong here? Thanks...
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...
1
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,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
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 ...

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.