Have a look at following code
Library to use
using System.Runtime.InteropServices;
Function declaration
private void SampleFunction([Optional]string optionalVar, string strVar)
{
}
And while giving call to function you can do like this
SampleFunction(optionalVar: "someValue","otherValue");
OR
SampleFunction("otherValue");
Reply if it helps.!:)