0

I added to my c# project an XML file as a Resource file (Resources -> Add Resource (down arrow) add existing file.)

I am reading from the file with no problems :

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,
                        columnNumber = Int32.Parse(p.Element("ColNumber").Value),
                        rowNumber = Int32.Parse(p.Element("rowNumber").Value),
                        columnWidth = Double.Parse(p.Element("colWidth").Value),
                        rowHeight = Double.Parse(p.Element("rowHeight").Value)
                    }; 
        
        return query.ToList();
    }

but I could not find way to add or modify the resource file element.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
MoShe
  • 6,197
  • 17
  • 51
  • 77
  • This is not clear. You added a resource file, and now you can't add it? What do you mean? – MPelletier Oct 17 '11 at 00:33
  • I think he wants to edit it from the program during runtime. I don't think it's possible, since the assembly is locked while the program is running. – Idan Arye Oct 17 '11 at 02:10

1 Answers1

1

It's not possible to change embedded resources.

fardjad
  • 20,031
  • 6
  • 53
  • 68