CLI Array Syntax in Visual Studio 2005 ??

hio=]

i need a buffer to read binary data into .so i will ues this method:
===========================
System.Int32 Read(System.Byte[] buffer, System.Int32 index, System.Int32 count)
    Member of System.IO.BinaryReader
==========================
as you can see the first parameter is System.Byte[], so i declared in my managed class  as follows:
using the old synatx
===========================
ref class pagingControl
{
      static const int pageArraySize =   100;
private:
      Byte nextBuffer [pageArraySize];

===========================

but i got this error:
==========================
error C4980: '__gc' : use of this keyword requires /clr:oldSyntax command line option
============================

so i changed to the new syntax:
===========================
ref class pagingControl
{
      static const int pageArraySize =   100;
private:

              array<Byte>^ prevBuffer [pageArraySize];

=================================



but i got this error:
==========================
error C2728: 'cli::array<Type> ^' : a native array cannot contain this managed type
        with
        [
            Type=unsigned char
        ]
        Did you mean 'array<cli::array<Type> ^>'?
        with
        [
            Type=unsigned char
        ]
============================


what should i do?
as_cloudsAsked:
Who is Participating?
 
AlexFMCommented:
array<Byte>^ prevBuffer;

In class constructor:

prevBuffer = gcnew array<Byte>(pageArraySize);
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.