-2

I'm trying to make a method for Load but when I use Internal in the method, it tells me that Internal is inaccessible due to it's protection level. Here is an example:

public class Internals
{

    // ---- PROPERTIES ---------------------------------------------

    /// <summary>
    /// Gets or sets internal data not required to edit a <see cref="Mdl0VertexData"/> instance.
    /// </summary>
    public Internals Internal { get; set; }

    /// <summary>
    /// Gets or sets the size of one full element in the raw data array, in bytes.
    /// </summary>
    public uint Length { get; set; }

    /// <summary>
    /// Gets or sets the raw data as a byte array.
    /// </summary>
    public uint Mdl0Offset { get; set; }

    /// <summary>
    /// Gets or sets the raw data as a byte array.
    /// </summary>
    public uint DataOffset { get; set; }

    /// <summary>
    /// Gets or sets the raw data as a byte array.
    /// </summary>
    public uint NameOffset { get; set; }

    /// <summary>
    /// Gets or sets the raw data as a byte array.
    /// </summary>
    public uint Index { get; set; }

    /// <summary>
    /// Gets or sets the raw data as a byte array.
    /// </summary>
    public uint ComponentCount { get; set; }

    /// <summary>
    /// Gets or sets the raw data as a byte array.
    /// </summary>
    public uint Format { get; set; }

    /// <summary>
    /// Gets or sets the raw data as a byte array.
    /// </summary>
    public Byte Divisor { get; set; }

    /// <summary>
    /// Gets or sets the raw data as a byte array.
    /// </summary>
    public Byte Stride { get; set; }

    /// <summary>
    /// Gets or sets the raw data as a byte array.
    /// </summary>
    public UInt16 VertexCount { get; set; }

    /// <summary>
    /// Gets or sets the raw data as a byte array.
    /// </summary>
    public UInt32 minimum1 { get; set; }

    public UInt32 minimum2 { get; set; }
    public UInt32 minimum3 { get; set; }
    public UInt32 maximum1 { get; set; }
    public UInt32 maximum2 { get; set; }
    public UInt32 maximum3 { get; set; }
    public UInt32 LayerCount { get; set; }
    public UInt32 LayerSize { get; set; }
    public UInt32 Padding1 { get; set; }
    public UInt32 Padding2 { get; set; }
    public UInt32 Padding3 { get; set; }
    public UInt32 Padding4 { get; set; }
    public UInt32 Padding5 { get; set; }
    public UInt32 Padding6 { get; set; }
        /// <summary>
        /// Gets or sets the offset to the first byte of the vertex buffer data.
        /// </summary>
        public Brres.BrresOffset Offset {
            get;
            set;
        }
    }
    private void Load(BrresLoaderContext context)
    {
        Internal = new Internals();

        Internal.Length = context.Reader.ReadUInt32();
        Internal.Mdl0Offset = context.Reader.ReadUInt32();
        Internal.DataOffset = context.Reader.ReadUInt32();
        Internal.Index = context.Reader.ReadUInt16();
        Internal.ComponentCount = context.Reader.ReadUInt16();
        Internal.Format = context.Reader.ReadUInt32();
        Internal.Divisor = context.Reader.ReadByte();
        Internal.Stride = context.Reader.ReadByte();
        Internal.VertexCount = context.Reader.ReadUInt16();
        Internal.minimum1 = context.Reader.ReadUInt32();
        Internal.minimum2 = context.Reader.ReadUInt32();
        Internal.minimum3 = context.Reader.ReadUInt32();
        Internal.maximum1 = context.Reader.ReadUInt32();
        Internal.maximum2 = context.Reader.ReadUInt32();
        Internal.maximum3 = context.Reader.ReadUInt32();
        Internal.LayerCount = context.Reader.ReadUInt32();
        Internal.LayerSize = context.Reader.ReadUInt32();
        Internal.Padding1 = context.Reader.ReadUInt32();
        Internal.Padding2 = context.Reader.ReadUInt32();
        Internal.Padding3 = context.Reader.ReadUInt32();
        Internal.Padding4 = context.Reader.ReadUInt32();
        Internal.Padding5 = context.Reader.ReadUInt32();
        Internal.Padding6 = context.Reader.ReadUInt32();
    }

Clearly, the class is public, so what can I do?

Ash
  • 5,786
  • 5
  • 22
  • 42
iSYan
  • 15
  • 7
  • Is `BrresLoaderContext` public? – kurakura88 Sep 27 '16 at 01:02
  • BrresLoaderContext is an internal class. Does that make it public? I'm kinda new to c# – iSYan Sep 27 '16 at 01:05
  • They are different. Look here: http://stackoverflow.com/questions/4182015/internal-vs-public-in-c-sharp – kurakura88 Sep 27 '16 at 01:06
  • @iSYan That's probably the issue. You've marked the property `Offset` as being `public` (in a class that is also `public`), but the type is `internal`. Can you make that class public, too? (Or change that property to be `internal`.) – Will Ray Sep 27 '16 at 01:07
  • It looks like Internal is the name of a property, as you are not declaring it during the Load method. Does it have a public setter? Is it inherited? – Jonathon Chase Sep 27 '16 at 01:08
  • `Internal` isn't defined anywhere in the code you've shown. have you defined it as a property without the correct access modifiers? – Ash Sep 27 '16 at 01:10
  • @AshwinNair Internal is defined as `Public Internals Internal`. – iSYan Sep 27 '16 at 01:15
  • RIght. @isYan, all this code is present in another class right? you can't have free floating methods (I mean methods not present in a class). – Ash Sep 27 '16 at 01:17
  • Also @iSYan, you'd need to either instantiate `Internal` or define it as `static` if you want to access it the way you are. – Ash Sep 27 '16 at 01:25

1 Answers1

0

You're not declaring Internal properly. You need to declare it with the proper type:

 Internals  Internal = new Internals();

or with var so that the compiler can decide which is the proper type.

 var  Internal = new Internals();
tinstaafl
  • 6,908
  • 2
  • 15
  • 22