How to call method written in VB.NET from C# with optional arguments
.net, c#, vb.net
Solution
No, in C#3 you simply have to pass all parameters. C#4 will have optional and named parameters.
You could off course create a few overloaded variations, but that is only an approximation.
Problem
I have a method written in VB.NET. It looks like this: ``` Shared Sub SomeMethod(ByVal Id As Guid, Optional ByVal str1 As String = "foo", Optional ByVal str2 As String = "") ``` I want to call this method from C# 3.0 and I want it to use its default arguments. I tried passing `System.Reflection.Missing.Value`, but I cannot cast it as String. Is there any way to do that? Thanks in advance for help.