•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C# section within the Software Development category of DaniWeb, a massive community of 423,887 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,268 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C# advertiser: Programming Forums
Views: 37566 | Replies: 2
![]() |
Consider the following code snippet:
There has got to be a better way to do this! The issue is, the ps.Operations property requries a 2-dimensional string array. (It's a list of operations to peform on a PostScript file, along with the parameters needed for each operation.)
I build that array dynamically, which means creating an ArrayList, which is "OPERATIONS" in the code. The challenge is to get the members of the ArrayList into a suitable string array. The above code is my solution.
There should be a way to do this without resorting to a loop. Just a couple of lines of code with some judicious casting, but I couldn't make anything work.
counter = 0;
workOperations = new String [OPERATIONS.Count,2];
foreach ( System.Array o in OPERATIONS)
{
workOperations[counter,0] = (string) o.GetValue(0,0);
workOperations[counter,1] = (string) o.GetValue(0,1);
counter++;
}
ps.Operations = workOperations;There has got to be a better way to do this! The issue is, the ps.Operations property requries a 2-dimensional string array. (It's a list of operations to peform on a PostScript file, along with the parameters needed for each operation.)
I build that array dynamically, which means creating an ArrayList, which is "OPERATIONS" in the code. The challenge is to get the members of the ArrayList into a suitable string array. The above code is my solution.
There should be a way to do this without resorting to a loop. Just a couple of lines of code with some judicious casting, but I couldn't make anything work.
![]() |
•
•
•
•
•
•
•
•
DaniWeb C# Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Error with array structures :( (C++)
- Creating a multi-dimensional Session variable (PHP)
- Passing multi-dimensional array (C)
- Multi-dimensional Arrays: (Python)
- multi dimensional array search xml parser (PHP)
- Need help passing a multi-dimensional array (C++)
- two-dimensional char array (Java)
Other Threads in the C# Forum
- Previous Thread: Array["name"] instead of Array[int]
- Next Thread: Data stored in Records



Linear Mode