我希望通过WCF将Azure Blob Storage的流直接返回到浏览器.基本上我有一个REST WCF服务,我希望用户通过该服务下载文件,而文件存储在Azure Blob存储中.
在这个问题
从WCF服务返回Azure BLOB作为流 - 我们需要关闭它吗?
它做了我喜欢的事情然而它首先将整个文件下载到新流,有没有办法将blob流作为来自WCF的返回流,因此WCF更像是流的代理?
我的问题是大文件(> 10MB),我真的不想从Azure存储中下载整个流,然后才开始将其返回给用户.
我这样做的原因是我在允许访问存储在Azure Blob存储中的文件之前对我的用户进行了一些安全检查,还有一些文件的大小可能高达1GB.
我有一个特定类型的对象的ArrayList,我需要将此ArrayList转换为类型列表.这是我的代码
Type objType = Type.GetType(myTypeName);
ArrayList myArrayList = new ArrayList();
object myObj0 = Activator.CreateInstance(type);
object myObj1 = Activator.CreateInstance(type);
object myObj2 = Activator.CreateInstance(type);
myArrayList.Add(myObj0);
myArrayList.Add(myObj1);
myArrayList.Add(myObj2);
Array typedArray = myArrayList.ToArray(objType); // this is typed
object returnValue = typedArray.ToList(); // this is fake, but this is what I am looking for
Run Code Online (Sandbox Code Playgroud)
没有可用于数组的ToList(),这是我正在寻找的行为
object returnValue = typedArray.ToList();
Run Code Online (Sandbox Code Playgroud)
所以我基本上把类型名称作为字符串,我可以从名称创建一个Type,并创建一个包含几个对象类型的集合,但是如何将其转换为List?我正在保护一个属性,当我做一个SetValue时,我的属性类型需要匹配.
非常感谢你.