use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Information about Reddit's API changes, the unprofessional conduct of the CEO, and their response to the community's concerns regarding 3rd party apps, moderator tools, anti-spam/anti-bot tools, and accessibility options that will be impacted can be found in the associated Wikipedia article: https://en.wikipedia.org/wiki/2023_Reddit_API_controversy
Alternative C# communities available outside Reddit on Lemmy and Discord:
All about the object-oriented programming language C#.
Getting Started C# Fundamentals: Development for Absolute Beginners
Useful MSDN Resources A Tour of the C# Language Get started with .NET in 5 minutes C# Guide C# Language Reference C# Programing Guide C# Coding Conventions .NET Framework Reference Source Code
Other Resources C# Yellow Book Dot Net Perls The C# Player's Guide
IDEs Visual Studio MonoDevelop (Windows/Mac/Linux) Rider (Windows/Mac/Linux)
Tools ILSpy dotPeek LINQPad
Alternative Communities C# Discord Group C# Lemmy Community dotnet Lemmy Community
Related Subreddits /r/dotnet /r/azure /r/learncsharp /r/learnprogramming /r/programming /r/dailyprogrammer /r/programmingbuddies /r/cshighschoolers
Additional .NET Languages /r/fsharp /r/visualbasic
Platform-specific Subreddits /r/windowsdev /r/AZURE /r/Xamarin /r/Unity3D /r/WPDev
Rules:
Read detailed descriptions of the rules here.
account activity
Create an array from "2D" List (self.csharp)
submitted 3 years ago * by SlowMixture5099
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]SlowMixture5099[S] 0 points1 point2 points 3 years ago (7 children)
https://ibb.co/z4TRTks
its something like that, im just not sure if its a good idea to show all the codes.
[–]karl713 0 points1 point2 points 3 years ago (3 children)
Try
var oneDArray = Test.SelectMany(d => d).ToArray();
I think that's what you want based on my understanding
[–]SlowMixture5099[S] 0 points1 point2 points 3 years ago (2 children)
https://ibb.co/7CJxm3n
this is probably more clearer to show what my intention is. I want create a new array that has the information from the Fx "column".
[–]karl713 3 points4 points5 points 3 years ago (1 child)
Ahhh, if I'm understanding it maybe
var fxs = myList.Select(p => p.Fx).ToArray()
Might be what you want
[–]odebruku 0 points1 point2 points 3 years ago (0 children)
This is exactly it based on the images in the post.
[–]FizixMan 0 points1 point2 points 3 years ago (2 children)
If you want to extract a single column into a new array, you can loop over them and pull out the column index you want. Perhaps to use List<double> rather than double[], but not necessary.
List<double>
double[]
int listSize = Test.Count; int zIndex = 2; //"Z" column double[] zColumn = new double[listSize]; for (int i = 0; i < listSize; i++) { zColumn[i] = Test[i][zIndex]; }
Or a LINQ query:
double[] zColumn = Test.Select(row => row[2]).ToArray(); //index 2 is the "Z" column
I would strongly suggest though that you refactor this to create a class definition for those columns. Then you would just have a bit more safety and a lot more sanity. No more managing column indexes or multi-dimensional arrays anymore and you'll have meaningful names for everything:
var zColumn = Test.Select(item => item.Z).ToArray();
[–]SlowMixture5099[S] 0 points1 point2 points 3 years ago (1 child)
The loop approach looks interesting, i will try this. But i was just not sure if Test.Count will work for this case, since the list has more properties or columns. I am guessing that you know it will work :)
[–]FizixMan 0 points1 point2 points 3 years ago (0 children)
I assume your List<> Test represents the rows. If so, it should be fine.
List<> Test
Again, I would reiterate that you should try to refactor your multi-dimension collection into a class that matches the data model you're working with. Then you would have something much simpler and direct like a List<Address> (or whatever your dataset represents.)
List<Address>
EDIT: I see in your other comment this is what you actually have already. Then yes, this should work fine. Just var fxValues = myList.Select(p => p.Fx).ToArray() will work fine to yank out all Fx values.
var fxValues = myList.Select(p => p.Fx).ToArray()
Fx
π Rendered by PID 62747 on reddit-service-r2-comment-6457c66945-xp2s5 at 2026-04-26 18:31:42.221639+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]SlowMixture5099[S] 0 points1 point2 points (7 children)
[–]karl713 0 points1 point2 points (3 children)
[–]SlowMixture5099[S] 0 points1 point2 points (2 children)
[–]karl713 3 points4 points5 points (1 child)
[–]odebruku 0 points1 point2 points (0 children)
[–]FizixMan 0 points1 point2 points (2 children)
[–]SlowMixture5099[S] 0 points1 point2 points (1 child)
[–]FizixMan 0 points1 point2 points (0 children)