打开一个文件,并将其转换为流在silverlight中 [英] open a file and convert it to stream in silverlight

查看:61
本文介绍了打开一个文件,并将其转换为流在silverlight中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在silverlight中如何打开文件并将其转换为流(不要使用open filedialog/savefiledialog,而仅使用网络中文件的路径)
谁能回答

in silverlight how to open a file and convert it to stream (dont use open filedialog/savefiledialog but use only path of the file in web)
can any one answer

推荐答案

打开文件与对话框无关.没有将其转换为流".
参见System.IO.在大多数情况下,您将使用类StreamReaderStreamWriter.这些类具有基础Stream作为属性.您可以使用流或文件名构造这些类的实例.请查看所有构造函数和帮助以获取更多详细信息. 始终使用using块.所有这些活动没有太多困难.

通常,这是可行的,但是...另请参阅Abhinav的答案.

—SA
Opening a file has nothing to do with dialogs. There is no "convert it to stream".
See System.IO. In most cases, you would use the class StreamReader or StreamWriter. These classes has underlying Stream as a property. You can construct instances of these classes with stream or a file name. Please see all the constructors and the help for further detail. Always use using block. There is no much difficulties in all this activity.

Generally, this works, but... please see also the Answer by Abhinav.

—SA


Silverlight在沙盒环境中运行.
您无法在Web应用程序中执行此操作.
Silverlight runs in a sandboxed environment.
You cannot do this in a web application.


这篇关于打开一个文件,并将其转换为流在silverlight中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆