Note: This question was asked at a time when C# did not yet support optional parameters (i.e. before C# 4).
We\'re building a web API tha
From this site:
http://www.tek-tips.com/viewthread.cfm?qid=1500861&page=1
C# does allow the use of the [Optional] attribute (from VB, though not functional in C#). So you can have a method like this:
using System.Runtime.InteropServices;
public void Foo(int a, int b, [Optional] int c)
{
...
}
In our API wrapper, we detect optional parameters (ParameterInfo p.IsOptional) and set a default value. The goal is to mark parameters as optional without resorting to kludges like having "optional" in the parameter name.