Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to short a data filling function?
    primarykey
    data
    text
    <p>I have some C# examples here, which i actually want to know how i can optimize them. I want to cut down the codeexample to the minimum. Is there a practical way to refactor the <code>GetDetails</code> in the <code>Tour</code> class or should i refactor it in the <code>CombiTour</code> class? And of course, how can i refactor it.</p> <pre><code>public class Tour { public string zielID; public string ort; public string strasse; public string nummer; public string plz; public string land; public string name; public string fahrtNummer; public Tour(string zielID) { this.zielID = zielID; } } public class CombiTour { public List&lt;Tour&gt; touren; public CombiTour() { this.touren = new List&lt;Tour&gt;(); } public void GetDetails() { for (int i = 0; i &lt; touren.Count; i++) { DataSet dsDetails = Tools.oGenericDs("SELECT Strasse, Nummer, PLZ, Ort, Land, Fahrtnummer FROM Ziele WHERE ZielID = " + this.touren[i].ZielID); this.touren[i].Strasse = dsDetails.Tables[0].Rows[0]["Strasse"].ToString(); this.touren[i].Nummer = dsDetails.Tables[0].Rows[0]["Nummer"].ToString(); this.touren[i].PLZ = dsDetails.Tables[0].Rows[0]["PLZ"].ToString(); this.touren[i].Ort = dsDetails.Tables[0].Rows[0]["Ort"].ToString(); this.touren[i].Land = dsDetails.Tables[0].Rows[0]["Land"].ToString(); this.touren[i].Fahrtnummer = dsDetails.Tables[0].Rows[0]["Fahrtnummer"].ToString(); dsDetails = Tools.oGenericDs("SELECT Name FROM Kunden WHERE ZielID = " + this.touren[i].ZielID); this.touren[i].Name = dsDetails.Tables[0].Rows[0]["Name"].ToString(); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload