About 899,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 constructor …

  2. c# - base () and this () constructors best practices - Stack Overflow

    Sep 12, 2017 · Correct; the constructors are always chained, and each class calls its base class's constructors. Using this you get to reuse this class's other constructor (which itself will use base, …

  3. 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 works fine if I just call

  4. 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 abstract class, then …

  5. .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 that they're …

  6. c# - JSON.net: how to deserialize without using the default constructor ...

    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 …

  7. 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 "a" will be …

  8. 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 (abstract) method …

  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 will be used?

  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 to the …