简体   繁体   中英

Understanding System.Uri

StreamResourceInfo sri;
sri = App.GetResourceStream(new Uri("WebBrowserIsoStorage;component/Images/textmate.jpg", UriKind.Relative)); 
using (BinaryReader reader = new BinaryReader(sri.Stream)) 
{ 
    using (BinaryWriter writer = new BinaryWriter(imageStream)) 
    { 
        while (sri.Stream.Position < sri.Stream.Length) 
        { 
            writer.Write(reader.ReadByte()); 
        } 
    } 
} 

What does the WebBrowserIsoStorage; in the path mean (line 2)?

That uri string is a relative Pack UrI (see Table 2 in the linked page for a similar example).

The first part ( WebBrowserIsoStorage ) is the assembly in which the resource (the textmate.jpg image) lives. The second part is the path to the resource within the assembly.

WebBrowserIsoStorage是Web浏览器的“ 隔离存储”位置。

这意味着系统中存在一个名为WebBrowserIsoStorage ,并且通过在组件后面跟随路径来尝试访问其资源。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM