Multidimensional Ar...
 
Notifications
Clear all

Multidimensional Arrays


Cain532
Posts: 1280
Topic starter
(@cain532)
Noble Member
Joined: 10 years ago

Hey there! So, today I'm going to be teaching you all about multidimensional arrays!!

Multidimensional arrays are essentially the same things as a standard array. I'll let the coding explain :p

[hide]

	//So, lets say you want something to be written when you change a comboBox entry. Vs having it set up like this
	private void comboBox1_SelectedIndex_Changed(Object sender, EventArgs e)
	{
	    if (comboBox1.SelectedIndex == 1)
	        WriteBytes(0x00, new byte[] { 0x11, 0x83, 0x35, 0x45});
	            if (comboBox1.SelectedIndex == 2)
	        WriteBytes(0x00, new byte[] { 0x16, 0x63, 0x34, 0x45});
	            if (comboBox1.SelectedIndex == 3)
	        WriteBytes(0x00, new byte[] { 0x14, 0x53, 0x34, 0x45});
	}
	//if you set up arrays as static byte[] you call load them into a multidimensional array like this
	byte[]
	    phase_0 = { 0x11, 0x83, 0x35, 0x45}),
	    phase_1 = { 0x16, 0x63, 0x34, 0x45}),
	    phase_2 = { 0x14, 0x53, 0x34, 0x45});
	
	byte[][] Phases =
	    {
	        phase_0, phase_1, phase_2
	    };
	
	    //which can be called like this
	private void comboBox1_SelectedIndex_Changed(Object sender, EventArgs e)
	{
	    WriteBytes(0x00, Phases[comboBox1.SelectedIndex]);
	}
	

[/hide]

Now, keep in mind it doesn't have to be a byte[], it can be any other variable so long as it supports an array function!

Reply
4 Replies
LEGACYY
Posts: 2350
(@legacyy)
Noble Member
Joined: 9 years ago

I just learn something new with comboBox 😀 Thank you Cain532 im telling we need to get this seminar stuff bumpin

Reply
Cain532
Posts: 1280
Topic starter
(@cain532)
Noble Member
Joined: 10 years ago

I just learn something new with comboBox 😀 Thank you Cain532 im telling we need to get this seminar stuff bumpin

You can use this method wire a for loop as well!

	for (int a = 0; a < Phases.Length; a++)
	{
	WriteBytes(0x00, Phases[a]);
	};
	
Reply
LEGACYY
Posts: 2350
(@legacyy)
Noble Member
Joined: 9 years ago

im still learning hahahaha you a good teacher though appreciate it Cain532

Reply
Posts: 0
(@The-Boss-MW)
New Member
Joined: 8 years ago

Hey there! So, today I'm going to be teaching you all about multidimensional arrays!!

Multidimensional arrays are essentially the same things as a standard array. I'll let the coding explain :p

Hidden content cannot be quoted.

Now, keep in mind it doesn't have to be a byte[], it can be any other variable so long as it supports an array function!

Awesome <a class="gctbbcode" rel="nofollow" target="_blank" href="">

Reply