I have 2 project. Nested project have 2 model: Model1in
and Model1Out
.
namespace Test.Nested
{
public class Model1in
{
#if NATIVE
public static explicit operator Model1in(Model1Out model)
{
return model == null ? null : new Model1in();
}
#endif
}
public class Model1Out
{
#if NATIVE
public static explicit operator Model1Out(Model1in model)
{
return model == null ? null : new Model1Out();
}
#endif
}
But at other project I want to convert object Model1in to Model1Out and back.
#define NATIVE
namespace Test.Native
{
....
Model1Out model = (Model1Out)Model1in;
}
The compiler generates an error and does not recognize the model conversion block. Asks to implement. It turns out he just does not see the block #define NATIVE
.
What is wrong? I add reference to project Nested
, Native
use him and define constant at project settngs.
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>DEBUG;NATIVE</DefineConstants>
</PropertyGroup>
If i use this implement for constant at project Nested
- no problems, but i have other project, where this block cannot be us and i wanna hidden implicit|explicit
construction.