M
marco_segurini
Hi,
The following C++ managed console application compile with no errors
or warning even if the readonly class members are not explicitly
initialized.
Is there any way to force the compiler to inform me that the readonly
class members are not explicitly initialized?
If I translate this program to C# using 'readonly' instead of
'initonly' the compiler returns me a warning for each readonly member
that is not expliciply inizialized.
TIA.
Marco.
///////////////////////////////////////////
#include "stdafx.h"
using namespace System;
ref class Hello
{
};
ref class TestInitOnly
{
public:
TestInitOnly()
{
}
initonly int i_;
initonly Hello^ h_;
};
int _tmain()
{
TestInitOnly^ init = gcnew TestInitOnly();
}
The following C++ managed console application compile with no errors
or warning even if the readonly class members are not explicitly
initialized.
Is there any way to force the compiler to inform me that the readonly
class members are not explicitly initialized?
If I translate this program to C# using 'readonly' instead of
'initonly' the compiler returns me a warning for each readonly member
that is not expliciply inizialized.
TIA.
Marco.
///////////////////////////////////////////
#include "stdafx.h"
using namespace System;
ref class Hello
{
};
ref class TestInitOnly
{
public:
TestInitOnly()
{
}
initonly int i_;
initonly Hello^ h_;
};
int _tmain()
{
TestInitOnly^ init = gcnew TestInitOnly();
}