我想使用azure函数c#将json存储在blob存储上
例如,我的json是:
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let sectionHeaderView : UIView = UIView()
let sectionHeaderImage: UIImage = UIImage(named: "Flag - ENGLAND.png")!
let sectionHeaderImageView : UIImageView = UIImageView(image: sectionHeaderImage)
sectionHeaderImageView.translatesAutoresizingMaskIntoConstraints = false
let imageViewWidthConstraint : NSLayoutConstraint = NSLayoutConstraint(item: sectionHeaderImageView, attribute: .width, relatedBy: .equal, toItem: sectionHeaderImageView, attribute: .width, multiplier: 0.0, constant: 40)
imageViewWidthConstraint.isActive = true
sectionHeaderImageView.addConstraint(imageViewWidthConstraint)
let imageViewHeightConstraint : NSLayoutConstraint = NSLayoutConstraint(item: sectionHeaderImageView, attribute: .height, relatedBy: .equal, toItem: sectionHeaderImageView, attribute: .height, multiplier: 0.0, constant: 40)
imageViewHeightConstraint.isActive = true
sectionHeaderImageView.addConstraint(imageViewHeightConstraint)
let imageViewLeadingConstraint : NSLayoutConstraint = NSLayoutConstraint(item: sectionHeaderImageView, attribute: .leading, relatedBy: .equal, toItem: sectionHeaderView, attribute: .left, multiplier: 1.0, constant: 50)
imageViewLeadingConstraint.isActive = true
sectionHeaderImageView.addConstraint(imageViewLeadingConstraint)
return sectionHeaderView
}
我想写入文件,甚至从文件中读取。
是否有使用Azure函数c#写入和读取文件的示例?
谢谢
答案 0 :(得分:0)
看看CloudStorageAccount
类:
使用这些可以创建CloudBlobClient
和CloudBlobContainer
。然后是CloudBlockBlob
类:
使用CloudBlockBlob
类:
CloudBlockBlob.UploadFromByteArray(...)
上传,和cloudBlockBlob.DownloadToByteArray(...)
下载文件。