Monday 15 March 2010

How can I populate and return a list of tuples in C# -


I had a good suggestion on how to save a tuple by one method:

Now I realize that my code produces not only two values, but an INIMERABLE & lt; & Gt; Here is my code, where the result is an IEnumerable in which I guess an anonymous object with a note and title. I am not sure how to keep the data in Tupal and how to get it myList variable Can I make an editor on top of my list?

  Public stable IEnumerable & lt; Tupal & lt; String, string & gt; & Gt; GetType6 () {var results = from entries in the feed. Discendents (a + "entry") give note = properties. Element (d + "Notes") Title = Properties. Element (d + "Title") // Here I'm not sure how to get information in Tupale //} var myList = GetType6 ();    

You can use it:

  Public stable IEnumerable & lt; Tupal & lt; String, string & gt; & Gt; GetType6 () Return from the entry in the feed. Residual (A + "Entry") Notes = Property. Give Element (D + "Notes") Title = Properties. Element (D + "Title") New Tupal & lt; Select string, string & gt; (Notes.Value, title.Value); }   

But honestly, what you have to spend to make your code more readable and working with the model:

  public class items {public string Notes {get; Set; } Public string title {get; Set; }}   

and after that:

  public static IEnumerable & lt; Items & gt; GetType6 () {Give Feed.Descendants (a + "Entry") Notes = Properties. Element (d + "Notes") Title = Properties. Select Element (d + "Title") New Items {Note = Notes. Value, title = title. value,}; }   

Regulating the tips makes the IMHO code very unreadable. When you start writing those results. Item1 , results.it2 , ..., results. Item 156 Things become awesome Result , Result. Note , ..., will not it?

No comments:

Post a Comment