Hi,
I was trying to use Microsoft.VisualBasic.Collection by adding reference to Microsoft.VisualBasic.dll in my project. I am facing problem with its Add method.
In Object Browser, I got this information about this method:
public void Add(object Item, string Key, object Before, object After)
It says last thee arguments are optional.
But whenever I try Add method with 1 / 2 /3 arguments then it gives me error at compile time that "No overload for method 'Add' takes '1' (or '2' or '3') arguments"
e.g.
using Microsoft.VisualBasic;
Collection a = new Collection();
int i =10;
a.Add(i);
It is giving me error. How can I add objects to my collection
I tried with 2 or 3 args then also same compile time error. And if I give all 4 args then I get run time crash as both "Before" and "after" can't be specified together.
-Aaryan

using Microsoft.VisualBasic.Collection
NeederOfVBHelp
cbpd86
System.Reflection.Missing.Value is used to signify that the argument is to be ignored from a .NET language which doesn't have optional parameters.
But.... why are you using the VisualBasic Collection There are many lists and collections in .NET that should suffice. Also, you can roll your own easily if you want something similar to the quirky VisualBasic Collection.
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter, VB to C++ converter
Clear VB: Cleans up VB.NET code
C# Code Metrics: Quick metrics for C#
Tb2006
David, Thanks for the reply.
I've to use VisualBasic collection because I am using OM of an application and calling one API in its OM returns me VisualBasic Collection.
Thanks,
Aaryan
Alastair Q
The VB Collection can be used from any .NET language (but it is not CLS compliant).
However, the VB Collection is an unusual object to return from an API.
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter, VB to C++ converter
Clear VB: Cleans up VB.NET code
C# Code Metrics: Quick metrics for C#