Skip to content

Instantly share code, notes, and snippets.

@azyobuzin
Created September 18, 2011 07:00
Show Gist options
  • Save azyobuzin/1224825 to your computer and use it in GitHub Desktop.
Save azyobuzin/1224825 to your computer and use it in GitHub Desktop.
using System.Xml.Linq;
namespace Azyobuzi.Azyotter.Models.TwitterDataModel
{
public class Source
{
public string Name { get; set; }
public string Href { get; set; }
public static Source Create(string source)
{
try
{
var xml = XElement.Parse(source);
return new Source()
{
Name = xml.Value,
Href = xml.Attribute("href").Value,
};
}
catch
{
return new Source()
{
Name = source,
Href = "http://twitter.com/"
};
}
}
}
}
using System.Xml.Linq;
namespace Uxeen.Twitter
{
public class Source
{
public string Name { get; set; }
public string Href { get; set; }
public static Source Create(string text)
{
try
{
var xml = XElement.Parse(text);
return new Source()
{
Name = xml.Value,
Href = xml.Attribute("href").Value,
};
}
catch
{
return new Source()
{
Name = text,
Href = "http://twitter.com/"
};
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment