Codeporting C#2java Engine converts C# optional arguments to java in such a way that they remain usable in generated java code which helps developers in a lot of ways. It can be specified from the definition of a constructor, method, indexer or delegate that its parameters are required or they are optional. Arguments must be provided for required parameters but they can be omitted for the optional parameters. If no Argument is sent for the optional parameter its default value is used. CodePorting C#2Java engine automatically handle this overload intelligently. Following example shows how CodePorting automatically converts C# optional arguments to java: [B]C# Code:[/B] using System; namespace CsPorter.Tests.Convert.DefaultParameters { [B]class[/B] DefParamerters { [B]static[/B] [B]void[/B] Main(string[] args) { ExampleClass anExample = [B]new[/B] ExampleClass("Test"); anExample.ExampleMethod(1, "One", 1); anExample.ExampleMethod(2, "Two"); anExample.ExampleMethod(3); ExampleClass anotherExample = [B]new[/B] ExampleClass("Provided name"); anotherExample.ExampleMethod(1, "One", 1); anotherExample.ExampleMethod(2, "Two"); anotherExample.ExampleMethod(3); } } [B]class[/B] ExampleClass { [B]private[/B] string _name; [B]public[/B] ExampleClass(string name = "Default name") { _name = name; } [B]public[/B] [B]void[/B] ExampleMethod([B]int[/B] required, string optionalstr = "default string", [B]int[/B] optionalint = 10) { Console.WriteLine(optionalstr); } } } [B]Java Code Generated by CodePorting:[/B] [B]package[/B] CsPorter.Tests.Convert.DefaultParameters; [I]// ********* THIS FILE IS AUTO PORTED FORM C# USING CODEPORTING.COM *********[/I] [B]class[/B] Test1 { [B]static[/B] [B]void[/B] main(String[] args) { ExampleClass anExample = [B]new[/B] ExampleClass("Test"); anExample.exampleMethod(1, "One", 1); anExample.exampleMethod(2, "Two"); anExample.exampleMethod(3); ExampleClass anotherExample = [B]new[/B] ExampleClass("Provided name"); anotherExample.exampleMethod(1, "One", 1); anotherExample.exampleMethod(2, "Two"); anotherExample.exampleMethod(3); } } [B]class[/B] ExampleClass { [B]private[/B] String _name; [B]public[/B] ExampleClass(String name) { _name = name; } [I]// Auto generated code to handle default paramters[/I] [B]public[/B] [B]void[/B] exampleMethod([B]int[/B] required) { String optionalstr = "default string"; [B]int[/B] optionalint = 10; exampleMethod(required, optionalstr); } [I]// Auto generated code to handle default paramters[/I] [B]public[/B] [B]void[/B] exampleMethod([B]int[/B] required, String optionalstr) { [B]int[/B] optionalint = 10; exampleMethod(required, optionalstr, optionalint); } [B]public[/B] [B]void[/B] exampleMethod([B]int[/B] required, String optionalstr, [B]int[/B] optionalint) { System.out.printf(optionalstr); } } Code (markup): It is clear from the above example that CodePorting generates three overloads of exampleMethod which were required to handle optional arguments in Java.