首先,把檔案的build action設為Resource
使用Application.GetResourceStream()取得內容
var ri = Application.GetResourceStream(new Uri("MyDatabase.Demo;component/InitData/InitData.xml", UriKind.Relative));if(ri != null){using(var sr = new System.IO.StreamReader(ri.Stream)){var xml = sr.ReadToEnd();}}
沒有留言:
張貼留言