Error 1 Inconsistent accessibility: field type 'Class0.Struct0' is less accessible th

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Angel Dominguez
    New Member
    • Feb 2012
    • 1

    Error 1 Inconsistent accessibility: field type 'Class0.Struct0' is less accessible th

    Anyone can help me? Its happening for all 3 structs(struct0 , struct1, and struct2)

    using System;
    using System.Runtime. InteropServices ;

    internal sealed class Class0
    {
    internal static int int_0; // data size: 4 bytes
    internal static int int_1; // data size: 4 bytes
    internal static int int_2; // data size: 4 bytes
    internal static int int_3; // data size: 4 bytes
    internal static Struct0 struct0_0; // data size: 32 bytes
    internal static Struct1 struct1_0; // data size: 256 bytes
    internal static Struct2 struct2_0; // data size: 16 bytes

    [StructLayout(La youtKind.Explic it, Size=0x20, Pack=1)]
    private struct Struct0
    {
    }

    [StructLayout(La youtKind.Explic it, Size=0x100, Pack=1)]
    private struct Struct1
    {
    }

    [StructLayout(La youtKind.Explic it, Size=0x10, Pack=1)]
    private struct Struct2
    {
    }
    }
  • Joseph Martell
    Recognized Expert New Member
    • Jan 2010
    • 198

    #2
    This means that you need to modify the accessibility level of either Class0 to make it "private" or modify the structs to be "internal".

    Essentially this error is telling you that with your current accessibility modifiers it is possible to write code that could access Class0 but would not be allowed to access any of your structs, which doesn't really make sense. Your contained types (Struct0, Struct1, and Strucgt2) must be at least as accessible as your containing types (Class0).

    Comment

    Working...