Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
0 votes
0 answers
33 views

In an xUnit theory I'd like to send an InlineData parameter of type string[][]. I can't seem to get it right. Is it doable, and if so, how? I would expect this to work at least: [InlineData(new string[...
1 vote
0 answers
51 views

I'm on a team with two other devs. For the past few months I've been working on a project in C# 12 independently, and only recently have the other devs pulled my code and run it. For one of them it ...
3 votes
1 answer
613 views

It appears that C# 12's collection initializers don't produce the same result as a ImmutableArray's Empty property; for example: using System; using System.Collections.Immutable; ...
2 votes
2 answers
2k views

Say I have code like this (or any kind of jagged structure): var intListList = new List<List<int>> { new() { 1, 2, 3 } }; I'd like to use a collection expression here. Resharper (EAP) ...
30 votes
2 answers
2k views

I'm reading Avalonia source code and I came across this sentence: return new MenuFlyoutPresenter { [!ItemsControl.ItemsProperty] = this[!ItemsProperty], [!ItemsControl.ItemTemplateProperty] = ...
1 vote
2 answers
681 views

I need to implement an immutable collection which supports collection initialization syntax. The problem is in order to support collection initialization syntax, the collection must provide ...
1 vote
2 answers
88 views

Context I have a List<T> of type Question. Class Question, in turn, contains a List<Answer>. Class Answer has a member called public Question Question { get; set; } which stores the ...
1 vote
2 answers
346 views

I noticed strange behaviour when initializing collection property. Consider: class X { public IList<int> Ints { get; set; } } I can initialize Ints like that: var theObject = new X { ...
2 votes
1 answer
603 views

I just stumbled upon the following issue: class Settings { // Let's set some default value: { 1 } public ICollection<int> AllowedIds = new List<int>() { 1 }; } static void Main(...
1 vote
1 answer
853 views

When using an index initializer to fill a dictionary without recreating it before that, is there an option to specify the null-forgiving operator somewhere? Example: public class Program { ...
1 vote
2 answers
156 views

I am using C# to hook into the FedEx API and I'm a bit stumped on how to modify some existing code to meet my needs. The snippet included is part of their canned code where they sample how to work ...
0 votes
2 answers
2k views

I'm designing a state machine class and want to use lambda expressions to represent conditions to satisfy the state transition objects. When I create a new State Transition object, I also want to pass ...
10 votes
4 answers
6k views

I was thinking about arrays and lists and wondering if and how classes can get an implementation to be initializable like them. Let's take this class as basis: class TestClass { private List<...
Battle's user avatar
  • 826
7 votes
1 answer
2k views

Is it possible in C# to do something similar to the following? var tigerlist = new List<Tigers>(){ Tail = 10, Teeth = 20 }; var tigers_to_cats_approximation = new List<Cat>() { ...
3 votes
3 answers
514 views

I'm creating a custom matrix class that only has a single 2D array to hold everything (I know that a 1D array is faster and better, but that's not the point of this implementation) the thing is, I'd ...
Raxmo's user avatar
  • 57

15 30 50 per page
1
2 3 4

AltStyle によって変換されたページ (->オリジナル) /