473,395 Members | 1,666 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,395 software developers and data experts.

Generic list from C++ to C#

Hi,

I have a field named "BaseClasses" in C++ as in the following simplified
code:

using Collections::Generic::List;
namespace A2M { namespace LipIntrospection {
public ref class BaseClassInfo
{
...
};

public ref class ClassInfo
{
public:
List<BaseClassInfo^> BaseClasses;
...
};
}}

The problem is that when "BaseClasses" is accessed in C#, I get an error
"is not supported in the language". I'm able to use the BaseClassInfo
class without problem and I'm also able to define a List<BaseClassInfo>
in C#. Out of curiosity, I compared the types of the list in C# and C++
and I got the following:

"System.Collections.Generic.List`1[[A2M.LipIntrospection.BaseClassInfo,
LipIntrospection, Version=1.0.2196.29053, Culture=neutral,
PublicKeyToken=null]]"

"System.Collections.Generic.List`1[[A2M.LipIntrospection.BaseClassInfo,
LipIntrospection, Version=1.0.2196.29233, Culture=neutral,
PublicKeyToken=null]]"

Is it possible that C++ and C# are using different versions of the
generic list?

Note that I'm pretty new to .Net and C#, so maybe I'm missing something?

Thx and regards,
Nicolas Fleury
Jan 5 '06 #1
2 5456

"Nicolas Fleury" <ni******@yahoo.com_remove_the_> wrote in message
news:%d********************@news20.bellglobal.com. ..
Hi,

I have a field named "BaseClasses" in C++ as in the following simplified
code:

using Collections::Generic::List;
namespace A2M { namespace LipIntrospection {
public ref class BaseClassInfo
{
...
};

public ref class ClassInfo
{
public:
List<BaseClassInfo^> BaseClasses;
...
};
}}

The problem is that when "BaseClasses" is accessed in C#, I get an error
"is not supported in the language". I'm able to use the BaseClassInfo
class without problem and I'm also able to define a List<BaseClassInfo> in
C#. Out of curiosity, I compared the types of the list in C# and C++ and
I got the following:

"System.Collections.Generic.List`1[[A2M.LipIntrospection.BaseClassInfo,
LipIntrospection, Version=1.0.2196.29053, Culture=neutral,
PublicKeyToken=null]]"

"System.Collections.Generic.List`1[[A2M.LipIntrospection.BaseClassInfo,
LipIntrospection, Version=1.0.2196.29233, Culture=neutral,
PublicKeyToken=null]]"

Is it possible that C++ and C# are using different versions of the generic
list?

Note that I'm pretty new to .Net and C#, so maybe I'm missing something?

Thx and regards,
Nicolas Fleury


List<BaseClassInfo^> BaseClasses;

should be

List<BaseClassInfo^> ^BaseClasses;

C# does not support stackbased semantics, so you must declare a reference.

Willy.

Jan 5 '06 #2
Willy Denoyette [MVP] wrote:
List<BaseClassInfo^> BaseClasses;

should be

List<BaseClassInfo^> ^BaseClasses;

C# does not support stackbased semantics, so you must declare a reference.


Oups. Thx, stupid mistake from me; haven't notice it for this field
because the preceding field was a simple type.

Thx,
Nicolas
Jan 6 '06 #3

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

Similar topics

3
by: Abhi | last post by:
In the following hypothetical example I want to build a generic list of unique string items. How should I implement the pred function so that it returns true/false if target string exists in the...
8
by: JAL | last post by:
Here is my first attempt at a deterministic collection using Generics, apologies for C#. I will try to convert to C++/cli. using System; using System.Collections.Generic; using System.Text; ...
0
by: Wiktor Zychla [C# MVP] | last post by:
We do have generic classes, methods and delegates. My question is: what reason prevents us from having generic properties and indexers? // impossible public List<T> GetList<T> { get { ... }
0
by: crazyone | last post by:
I've got a gaming framework i'm building and i want to save myself the trouble of reading and writting the complete game data to a custom file and load/save it to an XML file but i'm getting...
3
by: Seth Gecko | last post by:
Hi I am working with generic lists of various objects and a control dealing with these lists. For instance: A parent form holds: dim Walls as List(Of wall) dim Segments as List(Of segment) ...
4
by: =?Utf-8?B?QkogU2FmZGll?= | last post by:
We have a class that has a public property that is of type List<T>. FXCop generates a DoNotExposeGenericLists error, indicating "System.Collections.Generic.List<Tis a generic collection designed...
1
by: Suds | last post by:
Hi, I'm having an issue with invoking a Generic method that takes Generic Arguments. My method signature is public void GenericMethodWithGenericArguments<E, V>(List<EtheFirstList,...
13
by: rkausch | last post by:
Hello everyone, I'm writing because I'm frustrated with the implementation of C#'s generics, and need a workaround. I come from a Java background, and am currently writing a portion of an...
5
by: Jon Slaughter | last post by:
I have some code like if (val.GetType().Name == typeof(List<>).Name) { } which lets me determine if val is a generic list(I've already taken care of the non-generic part but I'd rather be...
2
by: SimonDotException | last post by:
I am trying to use reflection in a property of a base type to inspect the properties of an instance of a type which is derived from that base type, when the properties can themselves be instances of...
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: 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
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.