473,382 Members | 1,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

How do I pass a C# ArrayList to a method that takes a MFC CList?

I am importing a visual 6 C++ dll into C#. The methods in the dll take a CList type and I was wondering what type in C# can I use that correctly matches the CList type. Is the ArrayList type in C# comparable or should I just create my own List type in C#?
Nov 15 '05 #1
1 3272
Hmmmm,

I doubt that this will be simple...

CList is not a COM object and it is not a C style array;
it is a C++ template class that implements a doubly linked
list. Because CList is a template class you won't be able
to do something exceedingly slick, like create a custom
MasrshalAs attribute for CList classes, because the .NET
framework doesn't support templates <yet>.

So if I were you I would:

1) Check around to see if M$ or a third party has
some "MFC .NET interoperability" support classes that will
help with CList and then pray that they work...

2) Failing that, consider the painful option of wrapping
the VS 6.0 DLL behind another VS 6.0 DLL that exposes the
CList data in a form that .NET can see --> aka a COM
SafeArray of COM objects, or a C style array of structs of
primtiive types...

3) Reject the VS 6.0 approach as too painful and instead
go the {almost as painful} route of a mixed model DLL; a
C++ DLL that contains both managed and unmanaged code. In
THEORY you can expose Managed C++ classes from the DLL
{that C# can use} and you can implement those classes such
that they properly initialize MFC and then manipulate the
CList.

--Richard
-----Original Message-----
I am importing a visual 6 C++ dll into C#. The methods in the dll take a CList type and I was wondering what type in
C# can I use that correctly matches the CList type. Is the
ArrayList type in C# comparable or should I just create my
own List type in C#?.

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ellie O'Donnell | last post by:
Hi, I wrote a DB2 stored procedure in COBOL, and now I need to prepare a CLIST in order to call it. This CLIST would be for people who want to use the stored procedure outside of COBOL or Pl/I....
1
by: Craig | last post by:
Hey Everyone - I'm trying to determine the fastest way of moving array information around and could use some help. Here's the setup: Class A stores a DateTime and an amount (a payment)....
6
by: Vern | last post by:
I'd like to make the following a generic method that all my forms can call to validate all the fields on the form. So how do I pass the form object that is represented as "this" in the following...
48
by: Alex Chudnovsky | last post by:
I have come across with what appears to be a significant performance bug in ..NET 2.0 ArrayList.Sort method when compared with Array.Sort on the same data. Same data on the same CPU gets sorted a...
1
by: tony | last post by:
Hello! I just wonder if you out there have any your suggestion about this matter. I have a class in this class I have an ArrayList. In one instance method in this class I fill this ArrayList...
5
by: =?Utf-8?B?SkI=?= | last post by:
Hello I am passing an arraylist to be filled with data from pgm1 to pgm2 to pgm3 where it gets filled, then I pass it back from pgm3 to pgm2 to pgm1 where I will use the data from arraylist. ...
1
by: =?Utf-8?B?SkI=?= | last post by:
Hello My pgm1 (User Interface Level) passes an empty ArrayList to pgm2 (Business Logic Level). pgm2 then calls pgm3 (Data Access Level) to populate the ArrayList. Question1: When pgm2 gets...
1
bajajv
by: bajajv | last post by:
Hi, While implementing CList class, I got linker errors for constructor and destructor. Below is the code - template<class TYPE, class ARG_TYPE = const TYPE&> class CList { protected: struct...
1
bajajv
by: bajajv | last post by:
Hi, What is the difference between CObList and CList? If we use a CList as - CList<CObject*, CObject*>, isnt it similar to CObList?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.