2011-10-17 137 views
0

我加入到我的C#項目中的XML文件作爲一個資源文件(資源 - >添加資源(向下箭頭)添加現有的文件。)編輯資源文件c#

我從文件中讀取數據,沒有任何問題:

static XElement resource; 
static List<PageType> allPageType; 


    static public List<PageType> getAllPageLayout() 
    { 

     try 
     { 
      resource = XElement.Parse(Properties.Resources.PageTypeConfig); 

     } 
     catch { } 
     var query = from p in resource.Elements() 
        select new PageType() 
        { 
         name = p.Element("name").Value, 
         culomnNumber = Int32.Parse(p.Element("CulNember").Value), 
         rowNumber = Int32.Parse(p.Element("rowNumber").Value), 
         culomnWidth = Double.Parse(p.Element("culWidth").Value), 
         rowHeight = Double.Parse(p.Element("rowHeight").Value) 

         }; 

     return query.ToList(); 

    } 

,但我找不到辦法添加修改資源文件中的元素。

+0

這個不清楚。你添加了一個資源文件,現在你不能添加它?你什麼意思? – MPelletier

+0

我想他想在運行時從程序中編輯它。我不認爲這是可能的,因爲在程序運行時程序集被鎖定。 –

回答

1

無法更改嵌入式資源。