am converting a vb.net component to c#, i get this error
Using the generic type 'System.Collections.ObjectModel.Collection<T>' requires '1' type arguments
This is what i did
in VB.NET i had this
Private _bufferCol As Collection
i did this in c#
private Collection _bufferCol = new Collection();
My declaration is
using Microsoft.VisualBasi;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Collections.ObjectModel;
Can any body help me please.
It's confused because there is a type named "Collection" in both the Microsoft.VisualBasic and the System.Collections.ObjectModel namespaces. You can fix things for a direct translation like this:
private Microsoft.VisualBasic.Collection _buffer = new Microsoft.VisualBasic.Collection();
But I don't recommend doing that. The Microsoft.VisualBasic namespace is intended mainly for easier migration away from older vb6-era code. You really shouldn't use it's Collection type any more.
Instead, adapt this code to use a generic List<T> or Collection<T>.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With