Dear, I started adventure with C# a month ago. Can You please help me with problem below?
How to insert the results obtained by Yield return and insert them into table correctly? As far as result I get the table filled by the same,last generated value (10+5=15). What I need is to have series of results generated step by step by "yield return" function.
public class Obliczenia
{
// double P1, P2, V, S, R, P1a, Sa, Va;
public IEnumerable<double> Wyniki
{
get
{
for (double Rf = 0; Rf <= 10; Rf += 1)
{
yield return Rf + 5; // finally here will be more complicated equation
}
}
}
string[] tablica1 = new string[100];
Obliczenia o = new Obliczenia();
foreach (double wynik in o.Wyniki)
{
for (int i = 0; i < 9; ++i)
{
tablica1[i] = wynik.ToString(); //I think, something wrong is here.
}