Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何让我的字典添加另一项(图像)<;字符串、字符串、图像>;?_C#_Image_Forms_Xamarin - Fatal编程技术网

C# 如何让我的字典添加另一项(图像)<;字符串、字符串、图像>;?

C# 如何让我的字典添加另一项(图像)<;字符串、字符串、图像>;?,c#,image,forms,xamarin,C#,Image,Forms,Xamarin,我正在尝试将图像存储到我的数据库(文件)中,我不确定如何执行它以将其作为图像和字符串一起发送,如果我执行ToString(),它会给我一个错误,因为它只希望它作为源/图像,因为我的数据库是“文件” 所以我在想,如果它起作用,我会将图像添加到我的字典中,对于我的字符串,在第三个命令中只键入null?或者有更好的选择?你看过这门课了吗?您可以这样使用它: Tuple<string, string, Image> postData = new Tuple<string, s

我正在尝试将图像存储到我的数据库(文件)中,我不确定如何执行它以将其作为图像和字符串一起发送,如果我执行ToString(),它会给我一个错误,因为它只希望它作为源/图像,因为我的数据库是“文件”

所以我在想,如果它起作用,我会将图像添加到我的字典中,对于我的字符串,在第三个命令中只键入null?或者有更好的选择?

你看过这门课了吗?您可以这样使用它:

Tuple<string, string, Image> postData =
     new Tuple<string, string, Image>(userId, info1, picture1);
Tuple postData=
新元组(userId、info1、picture1);
编辑:

回答你下面的问题。可以将元组添加到集合中,如下所示:

List<Tuple<string, string, Image>> postData = new List<Tuple<string, string, Image>>();
postData.Add(new Tuple<string, string, Image>(userId, info1, picture1));
List postData=new List();
Add(新元组(userId,info1,picture1));

要在Parse中存储图像,请使用Parse文件。啊好的。嗯,我应该在哪里把它转换成parsefile?我应该先将我的streamimage存储为字符串吗?这是我的高级代码。图片是流格式的(Xamarin.Forms.StreamImageSource),但我不知道从这里可以去哪里阅读文档!第二段说,您可以从stream.ok创建一个ParseFile,现在就知道我需要添加什么包来查找ParseFile?好的。但是我将如何实现数据库代码,例如:“info1”、“userId”等,我不知道。那不是你问的问题。你的代码没有显示任何数据库交互。我想用和我的目录相同的方式使用它,所以我也得到了“databaseinfo”。postData.Add(“userId”,userId);postData.Add(“info1”,info1);添加(“info2”,info2);这个。我不能用元组“添加”哦,你可以创建一个列表
        postData.Add ("userId", userId);
        postData.Add ("info1", info1);
        postData.Add ("info2", info2);
        postData.Add ("picture1", picture1); //error here because it is an image and it only wants strings.
Tuple<string, string, Image> postData =
     new Tuple<string, string, Image>(userId, info1, picture1);
List<Tuple<string, string, Image>> postData = new List<Tuple<string, string, Image>>();
postData.Add(new Tuple<string, string, Image>(userId, info1, picture1));