Like this:
public Sample(string str) : this(int.Parse(str)) { }
Related Contents:
- What is the best way to give a C# auto-property an initial value?
- Calling the base constructor in C#
- Virtual member call in a constructor
- Interface defining a constructor signature?
- Can constructors be async?
- Call asynchronous method in constructor?
- How to do constructor chaining in C#
- Constructor of an abstract class in C#
- What’s the difference between an object initializer and a constructor?
- Why can’t the C# constructor infer type?
- Code snippet or shortcut to create a constructor in Visual Studio
- C# constructor execution order
- C# static class constructor
- C# Error: Parent does not contain a constructor that takes 0 arguments
- Is there an alternative to bastard injection? (AKA poor man’s injection via default constructor)
- C# : assign data to properties via constructor vs. instantiating
- Inheritance with base class constructor with parameters [duplicate]
- How do I check if a type provides a parameterless constructor?
- Struct constructor: “fields must be fully assigned before control is returned to the caller.”
- ‘UserControl’ constructor with parameters in C#
- Using C# reflection to call a constructor
- C# member variable initialization; best practice?
- DataContractSerializer doesn’t call my constructor?
- Is it important to unit test a constructor?
- Is it possible to create constructor-extension-method ? how?
- When is a custom attribute’s constructor run?
- C# constructors overloading
- a constructor as a delegate – is it possible in C#?
- Call one constructor from the body of another in C#
- Sending reference of object before its construction
- Closing a form during a constructor
- What setup code should go in Form Constructors versus Form Load event?
- Abstract constructor in C# [duplicate]
- Base Class Doesn’t Contain Parameterless Constructor?
- In C#, do you need to call the base constructor?
- How can I have an overloaded constructor call both the default constructor as well as an overload of the base constructor?
- Best way to check for null parameters (Guard Clauses)
- How do I create a C# array using Reflection and only type info? [duplicate]
- C# inheritance and default constructors
- Static constructor in C#
- C# How to execute code after object construction (postconstruction)
- How do I set a readonly field in an initialize method that gets called from the constructor?
- Initializing a Generic.List in C#
- Exception in static constructor
- Modifying parameter values before sending to Base constructor
- how do i call both constructor initializers, base() and this()?
- What is the return type of a constructor in C#?
- Is the “textual order” across partial classes formally defined?
- Factory vs instance constructors
- Is it possible to override a constructor in C#?