Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 72043

Cast generic Object to class

$
0
0

I am currently trying to cast a generic object to a specific class, with no luck yet.

Here is the scenario. I am receiving a generic object, and need to convert it to a specific type of a class. I tried the below, but none is working. Any ideas on how to make this work would be greatly appreciated.

class speicificClass()
{
str parm1, parm2;

public str parm1(str _parm1 = parm1)
{
parm1 = _parm1
return parm1
}

public str parm2(str _parm2 = parm2)
{
parm2 = _parm2
return parm2
}
}

Object genericClass;

SpecificClass specificClass;


//method 1 - cast generic to specific
specificClass = genericClass as SpecificClass();

//method 2
specificClass = genericClass;



Viewing all articles
Browse latest Browse all 72043

Trending Articles