Pass 1 Dimension of a 2D array to a function easily? - Page 1
Forum section: electronics / general

author: Stonent
author_rank: Super Contributor
timestamp: December 07, 2014, 06:43:39 pm
content: As a personal project I'm working on a C# based character builder that allows generating a character for a 5x7 LED display.EDIT: This turned into a long post, here's the TLDR version: Is there a way to pass the second dimension of a 2D array as if it were a 1D array to a function/Method?(Begin long version)I'm using the following from an AVR C based program as the base:Code:const unsigned char FONT_CHARS PROGMEM ={{ 0x00, 0x00, 0x00, 0x00, 0x00 }, // (space){ 0x00, 0x00, 0x5F, 0x00, 0x00 }, // !{ 0x00, 0x07, 0x00, 0x07, 0x00 }, // "{ 0x14, 0x7F, 0x14, 0x7F, 0x14 }, // #{ 0x24, 0x2A, 0x7F, 0x2A, 0x12 }, // ${ 0x23, 0x13, 0x08, 0x64, 0x62 }, // %{ 0x36, 0x49, 0x55, 0x22, 0x50 }, // &{ 0x00, 0x05, 0x03, 0x00, 0x00 }, // '{ 0x00, 0x1C, 0x22, 0x41, 0x00 }, // ({ 0x00, 0x41, 0x22, 0x1C, 0x00 }, // ){ 0x08, 0x2A, 0x1C, 0x2A, 0x08 }, // *{ 0x08, 0x08, 0x3E, 0x08, 0x08 }, // +{ 0x00, 0x50, 0x30, 0x00, 0x00 }, // ,{ 0x08, 0x08, 0x08, 0x08, 0x08 }, // -{ 0x00, 0x60, 0x60, 0x00, 0x00 }, // .{ 0x20, 0x10, 0x08, 0x04, 0x02 }, // /{ 0x3E, 0x51, 0x49, 0x45, 0x3E }, // 0{ 0x00, 0x42, 0x7F, 0x40, 0x00 }, // 1{ 0x42, 0x61, 0x51, 0x49, 0x46 }, // 2{ 0x21, 0x41, 0x45, 0x4B, 0x31 }, // 3{ 0x18, 0x14, 0x12, 0x7F, 0x10 }, // 4{ 0x27, 0x45, 0x45, 0x45, 0x39 }, // 5{ 0x3C, 0x4A, 0x49, 0x49, 0x30 }, // 6{ 0x01, 0x71, 0x09, 0x05, 0x03 }, // 7{ 0x36, 0x49, 0x49, 0x49, 0x36 }, // 8{ 0x06, 0x49, 0x49, 0x29, 0x1E }, // 9{ 0x00, 0x36, 0x36, 0x00, 0x00 }, // :{ 0x00, 0x56, 0x36, 0x00, 0x00 }, // ;{ 0x00, 0x08, 0x14, 0x22, 0x41 }, // <{ 0x14, 0x14, 0x14, 0x14, 0x14 }, // ={ 0x41, 0x22, 0x14, 0x08, 0x00 }, // >{ 0x02, 0x01, 0x51, 0x09, 0x06 }, // ?{ 0x32, 0x49, 0x79, 0x41, 0x3E }, // @{ 0x7E, 0x11, 0x11, 0x11, 0x7E }, // A{ 0x7F, 0x49, 0x49, 0x49, 0x36 }, // B{ 0x3E, 0x41, 0x41, 0x41, 0x22 }, // C{ 0x7F, 0x41, 0x41, 0x22, 0x1C }, // D{ 0x7F, 0x49, 0x49, 0x49, 0x41 }, // E{ 0x7F, 0x09, 0x09, 0x01, 0x01 }, // F{ 0x3E, 0x41, 0x41, 0x51, 0x32 }, // G{ 0x7F, 0x08, 0x08, 0x08, 0x7F }, // H{ 0x00, 0x41, 0x7F, 0x41, 0x00 }, // I{ 0x20, 0x40, 0x41, 0x3F, 0x01 }, // J{ 0x7F, 0x08, 0x14, 0x22, 0x41 }, // K{ 0x7F, 0x40, 0x40, 0x40, 0x40 }, // L{ 0x7F, 0x02, 0x04, 0x02, 0x7F }, // M{ 0x7F, 0x04, 0x08, 0x10, 0x7F }, // N{ 0x3E, 0x41, 0x41, 0x41, 0x3E }, // O{ 0x7F, 0x09, 0x09, 0x09, 0x06 }, // P{ 0x3E, 0x41, 0x51, 0x21, 0x5E }, // Q{ 0x7F, 0x09, 0x19, 0x29, 0x46 }, // R{ 0x46, 0x49, 0x49, 0x49, 0x31 }, // S{ 0x01, 0x01, 0x7F, 0x01, 0x01 }, // T{ 0x3F, 0x40, 0x40, 0x40, 0x3F }, // U{ 0x1F, 0x20, 0x40, 0x20, 0x1F }, // V{ 0x7F, 0x20, 0x18, 0x20, 0x7F }, // W{ 0x63, 0x14, 0x08, 0x14, 0x63 }, // X{ 0x03, 0x04, 0x78, 0x04, 0x03 }, // Y{ 0x61, 0x51, 0x49, 0x45, 0x43 }, // Z{ 0x00, 0x00, 0x7F, 0x41, 0x41 }, // [{ 0x02, 0x04, 0x08, 0x10, 0x20 }, // "\"{ 0x41, 0x41, 0x7F, 0x00, 0x00 }, // ]{ 0x04, 0x02, 0x01, 0x02, 0x04 }, // ^{ 0x40, 0x40, 0x40, 0x40, 0x40 }, // _{ 0x00, 0x01, 0x02, 0x04, 0x00 }, // `{ 0x20, 0x54, 0x54, 0x54, 0x78 }, // a{ 0x7F, 0x48, 0x44, 0x44, 0x38 }, // b{ 0x38, 0x44, 0x44, 0x44, 0x20 }, // c{ 0x38, 0x44, 0x44, 0x48, 0x7F }, // d{ 0x38, 0x54, 0x54, 0x54, 0x18 }, // e{ 0x08, 0x7E, 0x09, 0x01, 0x02 }, // f{ 0x08, 0x14, 0x54, 0x54, 0x3C }, // g{ 0x7F, 0x08, 0x04, 0x04, 0x78 }, // h{ 0x00, 0x44, 0x7D, 0x40, 0x00 }, // i{ 0x20, 0x40, 0x44, 0x3D, 0x00 }, // j{ 0x00, 0x7F, 0x10, 0x28, 0x44 }, // k{ 0x00, 0x41, 0x7F, 0x40, 0x00 }, // l{ 0x7C, 0x04, 0x18, 0x04, 0x78 }, // m{ 0x7C, 0x08, 0x04, 0x04, 0x78 }, // n{ 0x38, 0x44, 0x44, 0x44, 0x38 }, // o{ 0x7C, 0x14, 0x14, 0x14, 0x08 }, // p{ 0x08, 0x14, 0x14, 0x18, 0x7C }, // q{ 0x7C, 0x08, 0x04, 0x04, 0x08 }, // r{ 0x48, 0x54, 0x54, 0x54, 0x20 }, // s{ 0x04, 0x3F, 0x44, 0x40, 0x20 }, // t{ 0x3C, 0x40, 0x40, 0x20, 0x7C }, // u{ 0x1C, 0x20, 0x40, 0x20, 0x1C }, // v{ 0x3C, 0x40, 0x30, 0x40, 0x3C }, // w{ 0x44, 0x28, 0x10, 0x28, 0x44 }, // x{ 0x0C, 0x50, 0x50, 0x50, 0x3C }, // y{ 0x44, 0x64, 0x54, 0x4C, 0x44 }, // z{ 0x00, 0x08, 0x36, 0x41, 0x00 }, // {{ 0x00, 0x00, 0x7F, 0x00, 0x00 }, // |{ 0x00, 0x41, 0x36, 0x08, 0x00 }, // }{ 0x08, 0x08, 0x2A, 0x1C, 0x08 }, // ->{ 0x08, 0x1C, 0x2A, 0x08, 0x08 }, // <-{ 0xFF, 0x41, 0x5D, 0x41, 0xFF }, // 096: psycho 2{ 0x00, 0x3E, 0x22, 0x3E, 0x00 }, // 097: psycho 1{ 0x06, 0x15, 0x69, 0x15, 0x06 }, // 098: nuke{ 0x0C, 0x1E, 0x3C, 0x1E, 0x0C }, // 099: solid heart{ 0x0C, 0x12, 0x24, 0x12, 0x0C }, // 100: outline heart{ 0x0A, 0x00, 0x55, 0x00, 0x0A }, // 101: flower{ 0x08, 0x14, 0x2A, 0x14, 0x08 }, // 102: diamond{ 0x07, 0x49, 0x71, 0x49, 0x07 }, // 103: cup{ 0x22, 0x14, 0x6B, 0x14, 0x22 }, // 104: star2{ 0x36, 0x36, 0x08, 0x36, 0x36 }, // 105: star3{ 0x0F, 0x1A, 0x3E, 0x1A, 0x0F } // 106: fox};I have that section loaded into C# as this:Code:byte[,] FONT_CHARS ={{ 0x00, 0x00, 0x00, 0x00, 0x00 }, // (space){ 0x00, 0x00, 0x5F, 0x00, 0x00 }, // !{ 0x00, 0x07, 0x00, 0x07, 0x00 }, // "{ 0x14, 0x7F, 0x14, 0x7F, 0x14 }, // #{ 0x24, 0x2A, 0x7F, 0x2A, 0x12 }, // ${ 0x23, 0x13, 0x08, 0x64, 0x62 }, // %{ 0x36, 0x49, 0x55, 0x22, 0x50 }, // &{ 0x00, 0x05, 0x03, 0x00, 0x00 }, // '{ 0x00, 0x1C, 0x22, 0x41, 0x00 }, // ({ 0x00, 0x41, 0x22, 0x1C, 0x00 }, // ){ 0x08, 0x2A, 0x1C, 0x2A, 0x08 }, // *{ 0x08, 0x08, 0x3E, 0x08, 0x08 }, // +{ 0x00, 0x50, 0x30, 0x00, 0x00 }, // ,{ 0x08, 0x08, 0x08, 0x08, 0x08 }, // -{ 0x00, 0x60, 0x60, 0x00, 0x00 }, // .{ 0x20, 0x10, 0x08, 0x04, 0x02 }, // /{ 0x3E, 0x51, 0x49, 0x45, 0x3E }, // 0{ 0x00, 0x42, 0x7F, 0x40, 0x00 }, // 1{ 0x42, 0x61, 0x51, 0x49, 0x46 }, // 2{ 0x21, 0x41, 0x45, 0x4B, 0x31 }, // 3{ 0x18, 0x14, 0x12, 0x7F, 0x10 }, // 4{ 0x27, 0x45, 0x45, 0x45, 0x39 }, // 5{ 0x3C, 0x4A, 0x49, 0x49, 0x30 }, // 6{ 0x01, 0x71, 0x09, 0x05, 0x03 }, // 7{ 0x36, 0x49, 0x49, 0x49, 0x36 }, // 8{ 0x06, 0x49, 0x49, 0x29, 0x1E }, // 9{ 0x00, 0x36, 0x36, 0x00, 0x00 }, // :{ 0x00, 0x56, 0x36, 0x00, 0x00 }, // ;{ 0x00, 0x08, 0x14, 0x22, 0x41 }, // <{ 0x14, 0x14, 0x14, 0x14, 0x14 }, // ={ 0x41, 0x22, 0x14, 0x08, 0x00 }, // >{ 0x02, 0x01, 0x51, 0x09, 0x06 }, // ?{ 0x32, 0x49, 0x79, 0x41, 0x3E }, // @{ 0x7E, 0x11, 0x11, 0x11, 0x7E }, // A{ 0x7F, 0x49, 0x49, 0x49, 0x36 }, // B{ 0x3E, 0x41, 0x41, 0x41, 0x22 }, // C{ 0x7F, 0x41, 0x41, 0x22, 0x1C }, // D{ 0x7F, 0x49, 0x49, 0x49, 0x41 }, // E{ 0x7F, 0x09, 0x09, 0x01, 0x01 }, // F{ 0x3E, 0x41, 0x41, 0x51, 0x32 }, // G{ 0x7F, 0x08, 0x08, 0x08, 0x7F }, // H{ 0x00, 0x41, 0x7F, 0x41, 0x00 }, // I{ 0x20, 0x40, 0x41, 0x3F, 0x01 }, // J{ 0x7F, 0x08, 0x14, 0x22, 0x41 }, // K{ 0x7F, 0x40, 0x40, 0x40, 0x40 }, // L{ 0x7F, 0x02, 0x04, 0x02, 0x7F }, // M{ 0x7F, 0x04, 0x08, 0x10, 0x7F }, // N{ 0x3E, 0x41, 0x41, 0x41, 0x3E }, // O{ 0x7F, 0x09, 0x09, 0x09, 0x06 }, // P{ 0x3E, 0x41, 0x51, 0x21, 0x5E }, // Q{ 0x7F, 0x09, 0x19, 0x29, 0x46 }, // R{ 0x46, 0x49, 0x49, 0x49, 0x31 }, // S{ 0x01, 0x01, 0x7F, 0x01, 0x01 }, // T{ 0x3F, 0x40, 0x40, 0x40, 0x3F }, // U{ 0x1F, 0x20, 0x40, 0x20, 0x1F }, // V{ 0x7F, 0x20, 0x18, 0x20, 0x7F }, // W{ 0x63, 0x14, 0x08, 0x14, 0x63 }, // X{ 0x03, 0x04, 0x78, 0x04, 0x03 }, // Y{ 0x61, 0x51, 0x49, 0x45, 0x43 }, // Z{ 0x00, 0x00, 0x7F, 0x41, 0x41 }, // [{ 0x02, 0x04, 0x08, 0x10, 0x20 }, // "\"{ 0x41, 0x41, 0x7F, 0x00, 0x00 }, // ]{ 0x04, 0x02, 0x01, 0x02, 0x04 }, // ^{ 0x40, 0x40, 0x40, 0x40, 0x40 }, // _{ 0x00, 0x01, 0x02, 0x04, 0x00 }, // `{ 0x20, 0x54, 0x54, 0x54, 0x78 }, // a{ 0x7F, 0x48, 0x44, 0x44, 0x38 }, // b{ 0x38, 0x44, 0x44, 0x44, 0x20 }, // c{ 0x38, 0x44, 0x44, 0x48, 0x7F }, // d{ 0x38, 0x54, 0x54, 0x54, 0x18 }, // e{ 0x08, 0x7E, 0x09, 0x01, 0x02 }, // f{ 0x08, 0x14, 0x54, 0x54, 0x3C }, // g{ 0x7F, 0x08, 0x04, 0x04, 0x78 }, // h{ 0x00, 0x44, 0x7D, 0x40, 0x00 }, // i{ 0x20, 0x40, 0x44, 0x3D, 0x00 }, // j{ 0x00, 0x7F, 0x10, 0x28, 0x44 }, // k{ 0x00, 0x41, 0x7F, 0x40, 0x00 }, // l{ 0x7C, 0x04, 0x18, 0x04, 0x78 }, // m{ 0x7C, 0x08, 0x04, 0x04, 0x78 }, // n{ 0x38, 0x44, 0x44, 0x44, 0x38 }, // o{ 0x7C, 0x14, 0x14, 0x14, 0x08 }, // p{ 0x08, 0x14, 0x14, 0x18, 0x7C }, // q{ 0x7C, 0x08, 0x04, 0x04, 0x08 }, // r{ 0x48, 0x54, 0x54, 0x54, 0x20 }, // s{ 0x04, 0x3F, 0x44, 0x40, 0x20 }, // t{ 0x3C, 0x40, 0x40, 0x20, 0x7C }, // u{ 0x1C, 0x20, 0x40, 0x20, 0x1C }, // v{ 0x3C, 0x40, 0x30, 0x40, 0x3C }, // w{ 0x44, 0x28, 0x10, 0x28, 0x44 }, // x{ 0x0C, 0x50, 0x50, 0x50, 0x3C }, // y{ 0x44, 0x64, 0x54, 0x4C, 0x44 }, // z{ 0x00, 0x08, 0x36, 0x41, 0x00 }, // {{ 0x00, 0x00, 0x7F, 0x00, 0x00 }, // |{ 0x00, 0x41, 0x36, 0x08, 0x00 }, // }{ 0x08, 0x08, 0x2A, 0x1C, 0x08 }, // ->{ 0x08, 0x1C, 0x2A, 0x08, 0x08 }, // <-{ 0xFF, 0x41, 0x5D, 0x41, 0xFF }, // 096: psycho 2{ 0x00, 0x3E, 0x22, 0x3E, 0x00 }, // 097: psycho 1{ 0x06, 0x15, 0x69, 0x15, 0x06 }, // 098: nuke{ 0x0C, 0x1E, 0x3C, 0x1E, 0x0C }, // 099: solid heart{ 0x0C, 0x12, 0x24, 0x12, 0x0C }, // 100: outline heart{ 0x0A, 0x00, 0x55, 0x00, 0x0A }, // 101: flower{ 0x08, 0x14, 0x2A, 0x14, 0x08 }, // 102: diamond{ 0x07, 0x49, 0x71, 0x49, 0x07 }, // 103: cup{ 0x22, 0x14, 0x6B, 0x14, 0x22 }, // 104: star2{ 0x36, 0x36, 0x08, 0x36, 0x36 }, // 105: star3{ 0x0F, 0x1A, 0x3E, 0x1A, 0x0F } // 106: fox};I have code already that can read and convert a character entry into binary. What I'm looking for is something I can't even figure out how to google. Basically is there a way to shift a character into a 1 Dimensional array in one move?I will have a method that takes a character entry (an array of 5 bytes) passed to it and displays it on the editor defined like thisCode:public void SetColors(byte[] editChar)What I was hoping was a way to pass FONT_CHAR to the editor easily.Pseudocode for it would be likeSetColors(FONT_CHAR[5,*]);So meaning pass the 5th character of the font as a 5 byte 1D array. Is that even possible without creating another byte array and loading it in with a for loop?I'm trying to use WPF and XAML instead of Windows Forms in everything I do because of the cross platform nature of XAML vs WinForms. So I've included an example of it making a 5 x 7 LED matrix. The color is set to a tan/grey by default.In the program I'll be using a line like this:Code:R1C1.Fill = new SolidColorBrush(Colors.Red);Which can light up one of the boxes as red.Since all the boxes are named by row and column (see XAML below), I can wipe them all one color with a for loop that looks for element names in the XAML like this:Code:public void SetColorsAllRed(){var rows = 7;var cols = 5;for (int c = 1; c < cols+1; c++)for (int r = rows; r > 0; r--){var rectName = string.Format("R{0}C{1}", r, c); // Use loop to address each pixel in format of R1C1 etc.var rect = (Rectangle)this.FindName(rectName); // create a temporary variable called rect that is basically an alias to the pixelrect.Fill = new SolidColorBrush(Colors.Red); // set it red}}Here is the XAML code I have so far for the display editor in case anyone is interested:Code:<Window x:Class="_5x7_Display_Calc.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"Title="MainWindow" Height="200" Width="300"><Grid><Rectangle Fill="#FFF4F4F5" Name="R1C1" HorizontalAlignment="Left" Height="10" Margin="10,10,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R1C2" HorizontalAlignment="Left" Height="10" Margin="20,10,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R1C3" HorizontalAlignment="Left" Height="10" Margin="30,10,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R1C4" HorizontalAlignment="Left" Height="10" Margin="40,10,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R1C5" HorizontalAlignment="Left" Height="10" Margin="50,10,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R2C1" HorizontalAlignment="Left" Height="10" Margin="10,20,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R2C2" HorizontalAlignment="Left" Height="10" Margin="20,20,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R2C3" HorizontalAlignment="Left" Height="10" Margin="30,20,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R2C4" HorizontalAlignment="Left" Height="10" Margin="40,20,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R2C5" HorizontalAlignment="Left" Height="10" Margin="50,20,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R3C1" HorizontalAlignment="Left" Height="10" Margin="10,30,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R3C2" HorizontalAlignment="Left" Height="10" Margin="20,30,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R3C3" HorizontalAlignment="Left" Height="10" Margin="30,30,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R3C4" HorizontalAlignment="Left" Height="10" Margin="40,30,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R3C5" HorizontalAlignment="Left" Height="10" Margin="50,30,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R4C1" HorizontalAlignment="Left" Height="10" Margin="10,40,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R4C2" HorizontalAlignment="Left" Height="10" Margin="20,40,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R4C3" HorizontalAlignment="Left" Height="10" Margin="30,40,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R4C4" HorizontalAlignment="Left" Height="10" Margin="40,40,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R4C5" HorizontalAlignment="Left" Height="10" Margin="50,40,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R5C1" HorizontalAlignment="Left" Height="10" Margin="10,50,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R5C2" HorizontalAlignment="Left" Height="10" Margin="20,50,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R5C3" HorizontalAlignment="Left" Height="10" Margin="30,50,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R5C4" HorizontalAlignment="Left" Height="10" Margin="40,50,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R5C5" HorizontalAlignment="Left" Height="10" Margin="50,50,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R6C1" HorizontalAlignment="Left" Height="10" Margin="10,60,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R6C2" HorizontalAlignment="Left" Height="10" Margin="20,60,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R6C3" HorizontalAlignment="Left" Height="10" Margin="30,60,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R6C4" HorizontalAlignment="Left" Height="10" Margin="40,60,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R6C5" HorizontalAlignment="Left" Height="10" Margin="50,60,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R7C1" HorizontalAlignment="Left" Height="10" Margin="10,70,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R7C2" HorizontalAlignment="Left" Height="10" Margin="20,70,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R7C3" HorizontalAlignment="Left" Height="10" Margin="30,70,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R7C4" HorizontalAlignment="Left" Height="10" Margin="40,70,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/><Rectangle Fill="#FFF4F4F5" Name="R7C5" HorizontalAlignment="Left" Height="10" Margin="50,70,0,0" Stroke="Black" VerticalAlignment="Top" Width="10"/></Grid></Window>

author: Gridstop
author_rank: Contributor
timestamp: December 08, 2014, 04:31:00 am
content: Declare your array as a jagged array, with separate array objects in each index of the main array.Code:int[][] blah = new int[][]{new int[] {1,2,3,4,5},new int[] {6,7,8,9,10}};Then this will evaluate to one of the sub arrays:Code:blah

author: Galaxyrise
author_rank: Frequent Contributor
timestamp: December 08, 2014, 05:58:08 am
content: As Gridstop already mentioned, jagged array will get you the array-of-arrays. But if you're in control of SetColors, then some other alternatives come to mind:Use a ulong instead of 5 bytesUse a single-dimension array for FONT_CHARS and pass SetColors the offset from the beginning (like howGetStringhandles this problem)Use a struct instead of a second array dimension (only mentioned for completeness)

author: ivaylo
author_rank: Frequent Contributor
timestamp: December 08, 2014, 08:35:21 am
content: I think a cast may also work - SetColors((byte)whatever_address), been a while...