From: MarkusSchaber on
Hi,

We currently have the problem that stylecop complains "All private
fields must be placed after all public fields. [StyleCop Rule
SA1202]". But the specific private static readonly field is used as an
input in the initialization expressions for several public static
readonly fields, so reversing the field order breaks initialization
order of those static members.

How should we deal with that?

Thanks,
Markus
From: Andrew Morton on
MarkusSchaber wrote:
> We currently have the problem that stylecop complains "All private
> fields must be placed after all public fields. [StyleCop Rule
> SA1202]". But the specific private static readonly field is used as an
> input in the initialization expressions for several public static
> readonly fields, so reversing the field order breaks initialization
> order of those static members.
>
> How should we deal with that?

Adjust the StyleCop rule? After all, it's mostly guidelines which are
subject to change every now and again anyway.

Andrew


From: Family Tree Mike on
On 2/23/2010 7:46 AM, MarkusSchaber wrote:
> Hi,
>
> We currently have the problem that stylecop complains "All private
> fields must be placed after all public fields. [StyleCop Rule
> SA1202]". But the specific private static readonly field is used as an
> input in the initialization expressions for several public static
> readonly fields, so reversing the field order breaks initialization
> order of those static members.
>
> How should we deal with that?
>
> Thanks,
> Markus

Can't you initialize the constants in the static constructor?

--
Mike
From: MarkusSchaber on
Hi,

On 24 Feb., 00:12, Family Tree Mike <FamilyTreeM...(a)ThisOldHouse.com>
wrote:
> On 2/23/2010 7:46 AM, MarkusSchaber wrote:
>
> Can't you initialize the constants in the static constructor?

It seems that works, thanks!

Markus