に見え、何かのように:
XElement resource = XElement.Parse(Properties.Resources.Pictures);
これらの拡張機能を使用する:(ちょうどあなたのルートにクラス/ファイルをコピーし、あなたのリソース名が写真であれば
<?xml version="1.0" encoding="ISO-8859-1"?>
<pictures>
<picture>
<path></path>
<appath></appath>
</picture>
</pictures>
あなたのプロジェクトのディレクトリ)http://searisen.com/xmllib/extensions.wiki
public class PicturesResource
{
XElement self;
public PicturesResource()
{ self = XElement.Parse(Properties.Resources.Pictures); }
public IEnumerable<Picture> Pictures
{ get { return self.GetEnumerable("picture", x => new Picture(x)); } }
}
public class Picture
{
XElement self;
public Pictures(XElement self) { this.self = self; }
public string Path { get { return self.Get("path", string.Empty); } }
public string AppPath { get { return self.Get("apppath", string.Empty); } }
}
その後、写真を結合することができるか、それらを見上げるん:
PicturesResource pictures = new PicturesResource();
foreach(Picture pic in pictures.Pictures)
{
string path = pic.Path;
string apppath = pic.AppPath;
}
または特定の画像を検索:
Picture pic = pictures.FirstOrDefault(p => p.Path = "some path");
if(pic != null)
{
// do something with pic
}
は、いくつかのコンテキストコードを使用することができます。 –