I need to implement an immutable collection which supports collection initialization syntax. The problem is in order to support collection initializat ...
I need to implement an immutable collection which supports collection initialization syntax. The problem is in order to support collection initializat ...
Context I have a List<T> of type Question. Class Question, in turn, contains a List<Answer>. Class Answer has a member called publ ...
I noticed strange behaviour when initializing collection property. Consider: I can initialize Ints like that: But I cannot do that: Any idea ...
I just stumbled upon the following issue: I understand why this happens: AllowedIds = { 1, 2 } is not an assignment but a collection initializer in ...
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 t ...
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 ...
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 ...
Is it possible in c# to do something similar to the following? I'm doing some XML apis and the request objects coming in are similar to the respons ...
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 ...
I'm planning to create an immutable class based on JObject. One of the requirement is to directly deserialize object onto my new custom class, just l ...
First of all, I don't even know what to use when passing on 4 parameters but no return value, I'll just use Func as an example. I do not want to use ...
I've been using C# for a while, but recently noticed that the behaviour of one of my unit tests changed depending on which variation of collection ini ...
I'd like to start off with that I'm new to C# so accessors and Object Initializers are a completely new concept to me. That said, I think I have an ok ...
I want to initialize WebControl objects, inline, but for some fields this is a little bit tricky. For instance when I try to initialize the Attributes ...
In C# you can initialize an array like so: As quoted in Custom Collection Initializers: The collection object to which a collection initializer ...
I am trying to add collection initializing to my class. I read about the initializers here: https://msdn.microsoft.com/en-us/library/bb384062.aspx#Anc ...
I would like to populate a collection using collection initializer that will call async methods: The aim is for all the GetDiagnosticsInfoX() metho ...
I have a custom Vector class that can be initialized several ways. It has the following constructor to create a vector of a given length with all zero ...
I have a custom Matrix class that I would like to implement a custom object initializer similar to what a double[,] can use but can not seem to figure ...
I have this simple code: So when I'm creating a Data class: The list was filled with strings "1", "2", "3", "4" even if it had no set. Why is t ...