Adding array to another array

Hi people :)

 

I have two web methods that are returning two different arrays from web service.

Now, is there a possibility that I add those returning arrays to one completely new array? How should I do this?

 

My methods are returning arrays of custom structures.

 

 

 


Break Down the Wall
0
Jagr
12/5/2008 3:13:26 PM
asp.net.getting-started 91979 articles. 3 followers. Follow

3 Replies
354 Views

Similar Articles

[PageSpeed] 35

 I'm going to assume Array and not an ArrayList or something like that. Just use the Array.Copy() method.


______________________________________

Robert Lindley | Sr. Software Engineer - MCP, MCAD
ASTRA Innovations, Ltd. - Better Solutions by Design.

--------------------------------------------------

I like points just as much as the next person. If I helped you out please help me out by marking my response as the ANSWER if or when it is.
0
Rampidbyter
12/5/2008 3:20:46 PM

OK...I have something like this...

  

structure1[] first = webservice.GetArray1();

structure1[] second = webservice.GerArray2();
 

Now I want to sum these two into a new one, something like:

 

 

structure1[] newArray = first + second;
 

 

I am not sure I can do this with Copy() method.


Break Down the Wall
0
Jagr
12/5/2008 3:30:24 PM

 using System;
public class SamplesArray  {

   public static void Main()  {

      // Creates and initializes two new Arrays.
      Array mySourceArray=Array.CreateInstance( typeof(String), 6 );
      mySourceArray.SetValue( "three", 0 );
      mySourceArray.SetValue( "napping", 1 );
      mySourceArray.SetValue( "cats", 2 );
      mySourceArray.SetValue( "in", 3 );
      mySourceArray.SetValue( "the", 4 );
      mySourceArray.SetValue( "barn", 5 );
      Array myTargetArray=Array.CreateInstance( typeof(String), 15 );
      myTargetArray.SetValue( "The", 0 );
      myTargetArray.SetValue( "quick", 1 );
      myTargetArray.SetValue( "brown", 2 );
      myTargetArray.SetValue( "fox", 3 );
      myTargetArray.SetValue( "jumps", 4 );
      myTargetArray.SetValue( "over", 5 );
      myTargetArray.SetValue( "the", 6 );
      myTargetArray.SetValue( "lazy", 7 );
      myTargetArray.SetValue( "dog", 8 );

      // Copies the source Array to the target Array, starting at index 6.
      mySourceArray.CopyTo( myTargetArray, 6 );
   }


______________________________________

Robert Lindley | Sr. Software Engineer - MCP, MCAD
ASTRA Innovations, Ltd. - Better Solutions by Design.

--------------------------------------------------

I like points just as much as the next person. If I helped you out please help me out by marking my response as the ANSWER if or when it is.
0
Rampidbyter
12/5/2008 3:42:43 PM
Reply:

Similar Artilces:

Arrays, Arrays, Arrays
I mainly come from a JScript classic ASP background and I'm liking both C#.net and JScript.net. Now I have to say... "What's happened to arrays?" They used to be so flexible and easy to use. Here are my quick questions... Am I allowed to create an array with a non specified length so that I can add to it? If not then how can I modify an array's length? Can I create an array with a named index eg myArray["apple"] = "tasty"; or is the hash table the equivalent for this now? The classic array methods and properties like pop(), push(), length etc... are ...

How to unshift to an array in an array of arrays?
How to unshift to an array in an array of arrays? > -----Original Message----- > From: Angerstein [mailto:ang@nmc-m.dtag.de] > Sent: Wednesday, August 28, 2002 6:12 AM > To: beginners@perl.org > Subject: How to unshift to an array in an array of arrays? > > > How to unshift to an array in an array of arrays? $ perl -d -e 1 ..... DB<1> @aoa = ([qw(foo bar baz)]) << create array of arrays DB<2> x @aoa 0 ARRAY(0x80f82dc) 0 'foo' 1 'bar' 2 'baz' DB<3> unshift @{$aoa[0]}, 'qu...

referring to an array in an array of arrays
How can I get at an array in an array of arrays? I'm creating the arrays using: $fComments[$i++] = [ @comments ]; Now I want to get back what I put in: print "$fComments[0]\n"; but this prints ARRAY(0x107671f0). How do I follow that pointer? (I really think we need a pre-beginners list... =) TIA. - B You can try something like this: print "@{$fComments[0]}\n"; Which will attempt to dereference the array at $fComments[0]. -----Original Message----- From: Bryan R Harris [mailto:Bryan_R_Harris@raytheon.com] Sent: Tue...

Concatenating arrays from arrays of arrays
Hello - I am trying to accumulate items in a flat list (array) by concatenating on to it the scalars contained in arrays which in turn are contained in arrays. The data is to be read in from a file rather than existing as literals in my code. Everything I try either crashes the computer or gives me an array of arrays instead of a flat list. I have been programming in Unicon which has a concatenate operator, but Perl makes very heavy weather of nested list management. Should I switch to Lisp, or is there a way of doing what I want to do in Perl? Regards _John Sampson_ On...

Array of Array.
How is possible to declare a DYNAMIC array of array ? I need something like a dynamic hash table whose pages grow up dynamically too (each one can have different number of elements). In other words, a matrix that can be dynamic in both dimension. example: [1,2,3...] [3,4..] [5] [6,7,8,9...] [.] .. .. .. Have you considered using a DataStore? -- <hopethishelps/> Roy Kiesler [TeamSybase] SDN CodeXchange -- http://codexchange.sybase.com "Marco Meoni - News" <mmeoni@usl4.toscana.it> wrote in message news:401ba036$1@forums-2-dub... > How ...

[@array] and \@array
Given the case, my @array = (1,2,3,4); my $var1 = [@array]; my $var2 = \@array; What's the difference between $var1 and $var2? Are they all refered to @array? Thanks guys. On 3/22/07, Jm lists <practicalperl@gmail.com> wrote: > Given the case, > > my @array = (1,2,3,4); > my $var1 = [@array]; > my $var2 = \@array; > > What's the difference between $var1 and $var2? > Are they all refered to @array? > Thanks guys. $var2 is a reference to @array. $var1 is a reference to new array. Observe #!/usr/bin/perl use strict; use war...

An array of arrays
Could anybody help me out here? Here's the message I just got from a guy I know: ----------- I was wondering if you know how to create and access an array of arrays in Perl. Basically I'm parsing an exported text file containing e-mails and I think I want to move some fields into arrays until I'm ready to do my report. Here basically is what I'm looking at doing: ^ | | Array 1 (messages) | | v <------ Array 2 -------> (message fields:FROM, TO, CC, etc, sensitivity, etc) I want to be able to search through the first array to count how many messag...

Array of arrays
Hi I'm trying to return from a web service a array of arrays, one of the arrays is a array of objects, which I tested separately and it's working fine, and another array of integer and another of strings. When I run the web service I got this:You must implement a default accessor on System.Array because it inherits from ICollectionDefault accessor what that means? Thank you very much.  As Heinlein said "specialization is for insects" explore beyond the universe. Could you pls post the relevant code ? hi rushan thank you for the reply the code is here:  ...

array of arrays
Hi, I have a simple question: how do I access an array in an array? @array = (@array1, array2); ### unless this is wrong... the idea behind it is, that I have a long list, and want to put all 25 entries in a seperate array in that big array. later on I want to be able to read one specific array at a certain position... -- cheers alex mailto:Keex@gmx.de you need to learn about references. read the: perldoc perllol here is the jist though. @all = (\@array1, \@array2 ... ); # ... so on to access first array and first element...

Array of Arrays
Hi, I am looking for a way to create an array of arrays which needs to be passed to Oracle database to minimize the round trips to hte server. I was successful in sending simple arrays so far but no idea on how to create array of arrays in PB. I have used structures to simulate this but looks like I can't send the PB structure to Oracle. Anyone has any suggestions? Thanks, Anil PB 11 or 12 I believe will have this native. <Anil> wrote in message news:422789a4.721c.1681692777@sybase.com... > Hi, > > I am looking for a way to create an array of ar...

array of arrays
Hi. =20 Im using a multidimensional array in the following way: $array[$i][$j][$k] =3D [ @list ]; where, @list is a 2-D array ie. = $list[][]. How do I access the individual elements of the array @list once Ive put it = into the array @array? Thanks. -ty On Thu, Oct 18, 2001 at 02:28:41PM -0600, Tyler Cruickshank wrote: > $array[$i][$j][$k] = [ @list ]; where, @list is a 2-D array ie. $list[][]. > > How do I access the individual elements of the array @list once Ive put it > into the array @array? $array[$i][$j][$k][$l][$m] eq $list[$l][$m] Howev...

Array of Arrays
Hi, I am looking for a way to create an array of arrays which needs to be passed to Oracle database to minimize the round trips to hte server. I was successful in sending simple arrays so far but no idea on how to create array of arrays in PB. I have used structures to simulate this but looks like I can't send the structure to Oracle. Anyone has any suggestions? Thanks, Anil Please don't cross-post. On 3 Mar 2005 14:02:47 -0800, Anil wrote: >Hi, > >I am looking for a way to create an array of arrays which >needs to be passed to Oracle database t...

extracting elements from arrays of arrays of arrays ;-)
Hiya All, I hope you'll forgive this oo perl rookie for asking a routine question. I'm not new to perl, but the bioperl module I'm working on is giving me a headache! ;-) Let's say I have this: my @array = qw(12 56 41 23); my $array_ref = \@array; # where $var1, $var2, and $var3 are other array references. my $ref = [$var1, $var2, $array_ref, $var3 ]; my @object = (); push @object, $ref; QUESTION: How do I obtain the array $array_ref refers to in this situtation? Let's say I want to give @new the values in @array. Thank many thanks for you...

help with array within another array
Hi: I just can't seem to figure this out. I am trying to declare two associative array (%nodeowner and %nodeseverity) within another array called %SESSION For example %nodeowner = ("node1", "john", "node2", "nancy"); %nodeseverity = ("node1", 5, "node2", 10); How do I declare %SESSION containing %nodeowner and %nodeseverity. And how do I access say the value John give node1 from the nodeowner array that is in SESSION? TIA Ravi _______________________________________________________________________________...

Web resources about - Adding array to another array - asp.net.getting-started

"Donald Trump's reprehensible call to bar Muslim immigrants from entering the United States tracks an ...
"Would such a proposal be constitutional? The answer is not what you might think..." Unless you've read all the many other op-eds dotted about ...

Benedict Cumberbatch to play WWII hero Jasper Maskelyne in ‘The War Magician’
Ever since I watched the Drunk History episode about Raold Dahl (starring Will Ferrell as Dahl), I’ve been hoping Hollywood would take notice ...

L.A. and Chicago Are Up Next for Google Fiber
Just a day after AT&T announced that it’s bringing gigabit fiber internet to the L.A. metro area , Google has announced that it’s exploring L.A. ...

‘Winds Of Winter’ Release Date: George R.R. Martin Doesn’t See Anyone Else Finishing ‘Game Of Thrones’ ...
While fans are still eager for a Winds of Winter release date confirmation, author George R.R. Martin remains hush about whether he’s already ...

Text to mom announcing death reveals 3rd Bataclan attacker
PARIS (AP) — The third gunman who terrorized Paris' Bataclan concert hall before being killed last month in the attack was identified Wednesday ...

Google's Pixel C tablet now available in the UK from £399
Google's Pixel C might not be the tablet to replace your laptop, but it's still a beautifully put together device with oodles of power. If you've ...

Yahoo to Spin Off Core Businesses, Including Yahoo Japan
New York Times Yahoo to Spin Off Core Businesses, Including Yahoo Japan New York Times SAN FRANCISCO — Yahoo said on Wednesday that it had ...

Australian police raid the home and offices of reported Bitcoin creator
Australian federal police have raided the Sydney home of Craig Steven Wright, the man who—just a few hours ago—was named by Wired and Gizmodo ...

Selena Gomez Victoria’s Secret 2015 Performance
Selena Gomez Performs “Can’t Keep My Hands to Myself”/”My Girls” at the Victoria’s Secret 2015 special on CBS. Watch: The post Selena Gomez ...

Kim Kardashian Fears Weight Gain As Kanye Admits He Loves Her Pregnancy Curves
Kim Kardashian doesn’t want to get weight even though her husband Kanye West doesn’t mind if she does.

Resources last updated: 12/9/2015 1:18:01 PM