From my question you will know I am an absolute beginner, but that's when one needs most help, right ?
To clarify the context of this question :
I made a basic game in VB and then translated it to C# in order to be able to use some C# code from another source. The 2 games separately run fine and even together they run as expected (silverlight). Now I need to bridge these 2 programs to return values from 1 game in the other.
The Silverlight app I constructed is based on very basic C# but it works very well, the other Silverlight App is written by a much more advanced developer (brilliant actually, wished I could thank him). I got this on the internet and is free to use. It is extremely well documented, however the author is unreachable so I cannot ask any questions there.
The first and only question in this thread, when answered would put me on the right track to bridge the 2 apps entirely.
Basically, I need the int values in an array to be written to int values in separate variables
The array can have from 0 to 5 elements - code below :
public int[] UpwardsValues()
{
var values = new List<int>();
foreach (Die die in Dice)
values.Add(die.UpwardsFacingValue());
values.Sort();
return values.ToArray();
}
Then, the program (in it's own game) writes the values to a text box as follows :
private void WriteDiceValues()
{
string resultsText = "";
foreach (int value in Dice.UpwardsValues())
{
resultsText += value + " ";
}
Results.Text = resultsText;
}
Now here is where I would like to bridge the 2 programs :
I don't need to write the values to a text box but to the separate already declared variables as
DiceVal1
DiceVal2
DiceVal3
DiceVal4
DiceVal5
5 variables maximum, sometimes less, never more.
Thats how I started - if someone could fill in the blanks it would help me tremendously at this stage.
private void WriteDiceVals()
{
{
Tried all sorts here, however failed miserably, help very much appreciated
}
}
With thanks to Edward, who by providing his Silverlight app with sourcecode on the internet has made me learn tremendously. Wished I found a way of contacting you, I hope you read this.
Also with thanks in advance to anyone helping me this step further.
Marc
Getting integer elements from an Array and writing them to variables C#
Started by MGVDP, Jan 20 2011 02:06 PM
No replies to this topic
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









