• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1257
  • Last Modified:

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?
0
as_clouds
Asked:
as_clouds
1 Solution
 
AlexFMCommented:
array<Byte>^ prevBuffer;

In class constructor:

prevBuffer = gcnew array<Byte>(pageArraySize);
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now