About 853,000 results
Open links in new tab
  1. 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 …

  2. 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 …

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

    Apr 9, 2011 · 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 …

  4. .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 …

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

    Select the constructor marked with an attribute of a specific name - like the default resolver, but without a dependency on the Json.Net package because you need to reference …

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

    Without "Constructor Chain", you must repeat initializaion code in all constractors of class. How it work? (Or, What is execution sequence in "Constructor Chain")? in above example, method …

  7. c# - Interface defining a constructor signature? - Stack Overflow

    While you can't define a constructor signature in an interface, I feel it's worth mentioning that this may be a spot to consider an abstract class. Abstract classes can define unimplemented …

  8. 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.

  9. 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 …

  10. Why can't the C# constructor infer type? - Stack Overflow

    Feb 1, 2016 · The constructor needs to have the same generic specification as the class itself. Otherwise it would be impossible to know if the int in your example would relate to the class or …