急........
我把XML嵌入资源
然后想把它调来用我在自己写的一个函数中直接调用
如下
Serialize("MessageConfigLayer2.xml", false);
false代表加载资源
但是出了异常异常是未能找到文件知道这是什么原因吗?
到底怎样才能实现把嵌入的XML调用出来
在线等待
急........

解决方案 »

  1.   

    使用Assembly.GetManifestResourceStream 方法来获取清单资源。
    ms-help://MS.MSDNQTR.v80.chs/MS.MSDN.v80/MS.NETDEVFX.v20.chs/cpref10/html/O_T_System_Reflection_Assembly_GetManifestResourceStream.htm
      

  2.   

    Assembly a = Assembly.GetExecutingAssembly();
    Stream stream = a.GetManifestResourceStream("命名空间.MessageConfigLayer2.xml");
      

  3.   


    Stream stream = Assembly.GetEntryAssembly().GetManifestResourceStream("SharpRegistry.Application_Data.Settings.xml");
    XmlDocument1.Load(stream);