1

I've created a dll .

The dll had a method,which is having 4 optional parameters and 2 required parameters.

When i try to call the method in VS2010, it's working well and good even though i supply only 2 required parameters.

But when i tried to call the method in VS2008, it is showing error message 'No overload for method takes 2 arguments'.

Do i need to pass the 4 optional parameters values as null inorder to get rid of this ?

Please help

Thanks,

Karthik Chintala
  • 5,465
  • 5
  • 30
  • 60

2 Answers2

3

Optional parameters are new to Visual Studio 2010 so aren't supported in 2008. You need to explictly pass arguments for the optional parameters.

Can you use optional parameters in code targeting .NET 3.5?

Community
  • 1
  • 1
Nick Jones
  • 6,413
  • 2
  • 18
  • 18
0

Optional parameters is a C# 4.0 feature so you won't be able to use it on C# 3.5. Send explicity the default value for those.

Claudio Redi
  • 67,454
  • 15
  • 130
  • 155
  • yes optional parameter was introduced in c# 4.0, you should target the .net fx 4.0 somehow in visual studio 2008 – S3ddi9 Aug 30 '12 at 12:41
  • Optional parameters are a VS 2010 feature not a C# 4.0 feature. Therefore @SéddikLaraba 's answer wouldn't work either. – xr280xr Oct 29 '12 at 20:20