C
C#14mo ago
fakie

❔ why is there a comma in the [] when working in a multidimensional array

im fairly advanced with c# but had no use to use multidimensional arrays for what im working on so i dont know why there is a comma like this [ , ]
8 Replies
Thinker
Thinker14mo ago
The comma specifies the dimensions of the array [] is one dimension, [,] is two dimensions, [,,] is three dimensions, etc. The dimension is part of the type itself
fakie
fakie14mo ago
alright tanks thanks
mtreit
mtreit14mo ago
In the rare cases I've ever needed something like a multi-dimensional array, I actually find jagged arrays (arrays of arrays) much more intuitive. Plus, they are (very counterintuitively) faster!
Thinker
Thinker14mo ago
And they also have way more standard library support.
mtreit
mtreit14mo ago
What's an example?
Thinker
Thinker14mo ago
Name one method in the BCL which uses 2d arrays when
fakie
fakie14mo ago
agreed
Accord
Accord14mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts
❔ LINQ expressions with "pipeline" patternBasically I need to process an AST in multiple steps to generate a LINQ expression from it. To that ❔ MAUI blazor windows handle URIHey so, I've been trying to get MAUI blazor to run as a single instance to handle custom URIs, with ✅ Tutorial For Desktop App Development???I've looked all over google and I cannot find a tutorial to teach me how to build a desktop applicat❔ can anyone help me figure out hashauth?Trying to edit debug settings but they're locked behind hashauth, anyone know how it works? https:/❔ Razor pages asp-validation-for="MyProperty " vs asp-validation-summary="All"I am working on a simple registration form using a Razor page, and having trouble getting a message ❔ ✅ Register instance of List as singletonThis feels like a dumb question, but I'm trying to keep a singleton instance of a List that can be a❔ Octokit can find the git hub repo but not the latest repository```csharp using Microsoft.AspNetCore.Mvc; using MooMooBotWebAPI.TokenAuthentication; using System.Ne❔ Dusplicate type names: using namespace vs changing the type names.Lets say you have 2 models with the same name like `MyApp.Customers.Orders` and `MyApp.Employees.Ord❔ How to create a list of generic objects?``` public class Item { DateTime Date; string Name; int Age; } public class ReportSetup<T> {✅ Is it possible to put a generic constraint on a record?If I have a record Card<T> (....) and I want to put a constraint on it, such as where T : class? is