About 680,000 results
Open links in new tab
  1. C# Object Constructor - shorthand property syntax - Stack Overflow

    You might be thinking of the "object initializer" in C#, where you can construct an object by setting the properties of the class, rather than using a parameterized constructor.

  2. .net - Calling the base constructor in C# - Stack Overflow

    If you need to call the base constructor in the middle of the override, then extract it to an actual method on the base class that you can call explicitly. The assumption with base constructors is …

  3. c# - Can constructors be async? - Stack Overflow

    Nov 16, 2011 · Constructor acts very similarly to a method returning the constructed type. And async method can't return just any type, it has to be either “fire and forget” void, or Task. If the …

  4. Constructor of an abstract class in C# - Stack Overflow

    Mar 15, 2015 · An abstract class constructor c# code example will be explained. But, the next question can also be arises, as if we cannot instantiate (construct an object using new) an …

  5. How to do constructor chaining in C# - Stack Overflow

    Without "Constructor Chain", you must repeat initializaion code in all constractors of class. in above example, method "a" will be executed first, and then instruction sequence will return to …

  6. c# - How to initialize a list with constructor? - Stack Overflow

    Feb 1, 2012 · Please guide me is among best practices to use constructor with for list initialization? How to assign values to list using a constructor, so if no value passed a default …

  7. c# - Call asynchronous method in constructor? - Stack Overflow

    Apr 14, 2014 · Summary: I would like to call an asynchronous method in a constructor. Is this possible? Details: I have a method called getwritings() that parses JSON data. Everything …

  8. .NET Core DI, ways of passing parameters to constructor

    Dec 21, 2018 · Having the following service constructor public class Service : IService { public Service(IOtherService service1, IAnotherOne service2, string arg) { } } What are the choices of

  9. c# - JSON.net: how to deserialize without using the default …

    Select the most specific private constructor so you can have multiple overloads, still without having to use attributes. Select the constructor marked with an attribute of a specific name - …

  10. When initializing in C# constructors what's better: initializer lists ...

    1 C# has a feature called . You can provide values which the compiler will use to initialize the specified members, and call the default constructor. For this to work you need to have a public …