分享

C#如何创建和访问资源DLL

 amine 2010-12-07
Create a "Class Library" project. Remove everything except the
AssemblyInfo.cs file from the project.
Add your XML and XSD files to the project and set their Build Action to
Embedded Resource
Then compile the project and you should have the resource library.

To retrieve the stored resources, you will need to load the assembly with
Assembly.Load or Assembly.LoadFrom and use the Assembly class'
GetManifestResourceStream method.
 
                _assembly = Assembly.GetExecutingAssembly();
                _imageStream = _assembly.GetManifestResourceStream("WindowsFormsApplication8.MyImage.bmp");
                _textStreamReader = new StreamReader(_assembly.GetManifestResourceStream("WindowsFormsApplication8.MyTextFile.txt"));

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多