Protected member cannot be declared in struct

CodeRush Classic shows the Protected member cannot be declared in struct code issue if a struct member has the protected access modifier.

Fix

Change the member access modifier.

Purpose

Highlights the struct member declarations, which would cause the 'Member name': new protected member declared in struct compilation error.

Example

public struct MyStruct
{
    protected bool SetData(object data)
    {
        if (Data != null || data == null)
            return false;
        Data = data;
        return true;
    }
    public string Name { get; set; }
    public object Data { get; private set; }
}

Fix:

public struct MyStruct
{
    public bool SetData(object data)
    {
        if (Data != null || data == null)
            return false;
        Data = data;
        return true;
    }
    public string Name { get; set; }
    public object Data { get; private set; }
}