簡單來說,步驟如下:
- 在方案管理員中,在要使用的檔案上按右鍵→屬性→建置動作→Resource
- 在程式中使用
StreamResourceInfo sr = Application.GetResourceStream(new Uri("SilverlightApplication1;component/MyFile.txt", UriKind.Relative));
- SilverlightApplication1為擁有此物件的NameSpace
- MyFile.txt為要使用的檔案,若是在txt資料夾下,則應該為component/txt/MyFile.txt
沒有留言:
張貼留言