Optional parameters for functions in c#

C# (before .net 4.0) does not support optional method arguments. However, there may be times when you are using components that were created in a language that supports optional arguments, such as legacy COM components or components created with Microsoft Visual Basic .NET.

class Example {    public void Test()     {        object missing = Type.Missing;       object urlblog = "http://blog.bugrapostaci.com";        VBTestService yourObject = new VBTestService();         // first parameter is url and other 3 are optional in definition of OptionalParameterFuction coded VB        yourObject.OptionalParameterFuction(ref urlblog, ref missing, ref missing, ref missing, ref missing);     } }

Happy Codding…

Advertisements