Why does Resharper think these listings are never used?

I have the following listings:

    private enum FontSizeType
    {
        XSmall, //9
        Small,  //12 
        Medium, //18
        Large,  //24
        XLarge, //36
        XXLarge //47
    }

    private enum AlignOptions
    {
        Left,
        Center,
        Right
    }

    private enum ValueType
    {
        Text,
        Barcode
    }

And the Resharper check tells me about all of them that "Enum member" XSmall "[etc.] is never used"

But I use them in my lists, for example:

   comboBoxType1.DataSource = Enum.GetNames(typeof(ValueType));

... so why did Resharper cheat? Or that?

+5
source share
2 answers

ReSharper does not detect implicit uses. You can use [UsedImplicitly] to say that your type member is used implicitly, and then it should stop complaining.

UsedImplicitlyAttribute , JetBrains.Annotations.dll, , . http://www.jetbrains.com/resharper/webhelp/Code_Analysis__Annotations_in_Source_Code.html.

[UsedImplicitly] .

+6

, : [SuppressMessage("ReSharper", "UnusedMember.Global")] public enum ComplianceStatus { Notcompliant, Unknown, Warning, Compliant, Pendingrestart, Pendinglogoff }

+2

All Articles