接受变量,而不是直接文件路径?
I'm not sure how to ask this question actually...
This API takes in the path of a file, can I have it take in a variable instead? binary of the file or string content of the file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不是直接的,但是有一个需要
StreamReader
的ImportFile
重载,因此您可以执行类似的操作:如果您将内容作为字节数组:
如果内容为字符串:
顺便说一下,糟糕的 API 设计...参数应该是
TextReader
,而不是StreamReader
>,所以我们可以使用StringReader
而不是将字符串转换为字节)另外,请注意主页上的示例不正确(没有
QifDom.Import
财产)Not directly, but there is an overload of
ImportFile
that takes aStreamReader
, so you can do something like that:If you have the content as a byte array:
If you have the content as a string:
(Bad API design, by the way... the parameter should have been
TextReader
, notStreamReader
, so we could have used aStringReader
rather than converting the string to bytes)Also, note that the example on the home page is incorrect (there is no
QifDom.Import
property)