// Using Attribute
private void SomeMethod([Optional] string param)
{
}
// Using Default Values
private void SomeMethod(string param = null)
{
}
// Using Optional Attribute
private void SomeMethod([Optional] string param)
{
...
}
// Using Default Values
private void SomeMethod(string param = null)
{
...
}
public void ExampleMethod(int required,
string optionalstr = "default string",
int optionalint = 10)
public void SomeMethod(int a, int b = 0){/*some code*/}
using System.Runtime.InteropServices;