如何将保存细节的对象传递给变量
我有一个场景,我必须得到字段(字段名称:Assignees)值并显示。在文档中,它的编写如下所示:
Hi,
I have a scenario where i have to get the field (Field name: Assignees) values and display. In the documentation it is written as shown below:
List<Int32> multiObject = ((List<Int32>)favoriteDocumentsField.Value);
for (int index = 0; index < multiObject.Count; index++) {
Int32 docID = multiObject[index];
Console.WriteLine("Artifact: {0} Field: {1} Value: {2}", employee.ArtifactID, favoriteDocumentsField.Name + " Object " + index, docID);
}
我没有使用Console.WriteLine,因为我在API中使用这个逻辑。所以,根据我的代码,我已经改变如下所示:
I am not using Console.WriteLine as i am using this logic in API. So, as per my code i have changed as shown below:
List<Int32> multiObject = ((List<Int32>)favoriteDocumentsField.Value);
string EmailAddress="";
for (int index = 0; index < multiObject.Count; index++) {
Int32 docID = multiObject[index];
EmailAddress += employee.ArtifactID + favouriteDocumentsField.Name + "Object: " + index, docID);
}
我在i附近收到错误,docID声明
I am getting error near i, docID stating "
only assignment call increment decrement await and new object expressions can be used as a statement". Any help would be appreciated. Please help me to display it.
What I have tried:
I tried tweaking the code but i am getting the syntax error.
查看您的代码:
Look at your code:
EmailAddress += employee.ArtifactID + favouriteDocumentsField.Name + "Object: " + index, docID);
这样做的结局是什么?
如果我把它减少一点就会更清楚:
What is the end of that doing?
If I cut it down a bit it'll be clearer:
EmailAddress += "a string", docID);
您期望什么?编译器用命令和它的东西是对的吗?
可能你的意思是:
What do you expect the compiler to do with the command and the stuff to it's right?
Probably, what you meant was:
EmailAddress += employee.ArtifactID + favouriteDocumentsField.Name + "Object: " + index + docID;
但是你需要考虑你所做的事情如果该行在一个循环内并且将所有电子邮件地址连接在一起,则工作:
But you need to think about what you are doign as that won't work either, given that the line is inside a loop and will concatenate all the "email addresses" together:
joe@gmail.commike@gmail.com@sara@mydomain.co.in
试试这个
Try this
EmailAddress += employee.ArtifactID + favouriteDocumentsField.Name + "Object: " + index, docID;
(删除)
最后。
[更新]
可能会替换,由 +
也可以提供帮助
(remove the )
at the end.
[Update]
May be replacing the ,
by a +
can help too