F
frankjones
Hi
I want to pass a 'slice' of a 2 dimensional array to a function that
accepts arrays of only 1 dimension. In C++ this is quite simple as
you just pass the array and miss out one of the dimensions.
In C# I can't get this to work. Does anyone know the best way to do
this?
(exmaple below of the code that won't work in C#)
public bool CreateData()
{
Single[,] multiData = new Single[50, 10];
ProcessData(ref multiData[50]);
}
public void ProcessData(ref Single[] rawData)
{
foreach(int s in rawData)
{
Console.WriteLine(s);
}
}
Many Thanks,
I want to pass a 'slice' of a 2 dimensional array to a function that
accepts arrays of only 1 dimension. In C++ this is quite simple as
you just pass the array and miss out one of the dimensions.
In C# I can't get this to work. Does anyone know the best way to do
this?
(exmaple below of the code that won't work in C#)
public bool CreateData()
{
Single[,] multiData = new Single[50, 10];
ProcessData(ref multiData[50]);
}
public void ProcessData(ref Single[] rawData)
{
foreach(int s in rawData)
{
Console.WriteLine(s);
}
}
Many Thanks,