User323983933 posted
Since this is posted in the MVC forum, I'll try to answer.
There are several C# array types that might be of use here. I am assuming you want to create some kind of library procedure that does this, as there isn't anything here that would be visible in a MVC page.
I am assuming your arrays are int arrays, as PHP doesn't seem to use strongly typed arrays.
Also, not sure what kind of database you're trying to access here. Most natural for ASP.NET MVC is SQL server. Even more natural is to include the
m_soal table in your applications Models and use Entity Framework on it.
But to directly answer your question, there are multiple kinds of arrays.
public void ArrayHandlingMethod()
{
//ARRAYS
//this way loads data into the array on create.
int[] bobotArray = new int[] { 1, 2, 5, 7, 9, 0 }; //loads an array on create
//arrays another way, note that you can't change the length of arrays once they are created. So you need a count up front.
int[] BobotArray6 = new int[6];
BobotArray6[0] = 1;
BobotArray6[1] = 23;
//this will loop through the array.
foreach(int item in bobotArray)
{
//do stuff
}
//this will also loop through the array
for(int i=0;i<bobotArray.Length;i++)
{
//do stuff
}
//LISTS
List<int> bobotList = new List<int>();//creates empty
bobotList.Add(1); //how to add items to the list
bobotList.Add(12);
//how to loop through the list
foreach( int item in bobotList)
{
//do stuff
}
}