1
En utilisant ce code, j'ai l'intention de remplir les variables.Problème lors de l'attribution d'une valeur à cette variable
http://www.dreamincode.net/forums/xml.php?showuser=146038
//Load comments.
var commentsXML = xml.Element("ipb").Element("profile").Element("comments");
this.Comments = (from comment in commentsXML.Descendants("comment")
select new Comment()
{
ID = comment.Element("id").Value,
Text = comment.Element("text").Value,
Date = comment.Element("date").Value,
UserWhoPosted = comment.Element("user").Value
}).ToList();
Le problème est UserWhoPosted est un objet de la classe User.cs POCO j'ai fait:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SharpDIC.Entities
{
public class Friend
{
public string ID { get; set; }
public string Name { get; set; }
public string Url { get; set; }
public string Photo { get; set; }
}
}
Comment pourrais-je remplir cet objet?
Oui, cela fonctionne exactement comme je le voulais. –