Hi Janez,
Hope this helps:
In the Dll
========
Int32[,] intArray;
public Int32[,] MyArray()
{
intArray=new Int32[2,2];
for (int i=0;i<2;i++)
{
for (int j=0;j<2;j++)
{
intArray[i,j]=(i*100)+j;
}
}
return intArray;
}
In Client Application
=================
Int32[,] array;
ClassLibrary1.Class1 cls=new ClassLibrary1.Class1();
array=cls.MyArray();
for (int i=array.GetLowerBound(0);i<=array.GetUpperBound(0);i++)
{
for(int
j=array.GetLowerBound(1);j<=array.GetUpperBound(1);j++)
{
Console.WriteLine(array[i,j].ToString());
}
}
Console.WriteLine("GetLowerBound(0): " +
array.GetLowerBound(0));
Console.WriteLine("GetUpperBound(0): " +
array.GetUpperBound(0));
Console.WriteLine("GetLowerBound(1): " +
array.GetLowerBound(1));
Console.WriteLine("GetUpperBound(1): " +
array.GetUpperBound(1));
}
If I misunderstood your concerns, please correct me.
Thanks,
Felix Wu
=============
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Quote:
>Newsgroups: microsoft.public.dotnet.languages.
CSharp >Subject: 2D arrays...
>Lines: 12
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
>Date: Sun, 24 Nov 2002 22:35:00 +0100
>NNTP-Posting-Host: 193.77.154.126
>X-Trace: news.siol.net 1038173804 193.77.154.126 (Sun, 24 Nov 2002
22:36:44 MET)
>NNTP-Posting-Date: Sun, 24 Nov 2002 22:36:44 MET
>Organization: Slovenija OnLine - SiOL
>Path:
cpmsftngxa06!tkmsftngp01!cppssbbsa01.microsoft.com!news-out.cwix.com!newsfe
e
d.cwix.com!news-hub.siol.net!news.siol.net!not-for-mail
Quote:
>Xref: cpmsftngxa06 microsoft.public.dotnet.languages.csharp:110899
>X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
>Hi!
>I have a dll returning a pointer to a block of memory which is a single
>block two dimensional
>array. Is there a way to type cast this pointer so that it would be
>possible to work on values from that array? Even a type-cast to a one
>dimensional array would do fine...
>Thanks!
>Janez