Problem with Attribute "XmlIncludeAttribute" in Managed C++

  • Thread starter Thread starter Danny Korach
  • Start date Start date
D

Danny Korach

Hi,

I have created a very basic Managed C++ project.
The contents is just bellow.
Two classes: Class1, Class2.
Class2 has a member of type Class1.
I'm trying to write code that serialize it using XML
serialization.
Before I even write my other code, the following code
won't compile with the following complication error on
the line of the "XmlIncludeAttribute":
--------------------
C3303: 'System::Xml::Serialization::XmlIncludeAttribute':
attribute can only be used on 'classes, structs, non-enum
value types, methods'
--------------------


Here is where my small code starts.

using namespace System;
using namespace System::Xml::Serialization;

namespace Project1
{
public __gc class Class1
{
public:
String * m_sName;
};

public __gc class Class2
{
public:

[System::Xml::Serialization::XmlIncludeAttribute
(__typeof(Class1))]
Class1 * m_objClass1;
};

}
 
Back
Top