Reputation: 1
I wanted to declare a variable like this in AX 2012 : classX[] error = new classX(); in a Class Y
[DataContractAttribute]
public classX
{
}
[DataContractAttribute]
public classY
{
classX[] error = new classX();
}
But I can't declare it, is that possible?
I tried it this way but it didn't work: Array error = Array of classX; classX error[] = new classX();
Upvotes: 0
Views: 129
Reputation: 11544
The proper way to do what you're trying to accomplish is below. Take a look at this link for some more info.
[DataContractAttribute]
class ClassYContract
{
List classXList;
}
[
DataMemberAttribute,
AifCollectionTypeAttribute('return', Types::Class, classStr(ClassXContract)),
AifCollectionTypeAttribute('_classXList', Types::Class, classStr(ClassXContract))
]
public List parmClassXList(List _classXList = classXList)
{
classXList = _classXList;
return classXList;
}
[DataContractAttribute]
class ClassXContract
{
}
Upvotes: 0