[英]I want to know the type of this value and how can I use it?
I'm creating a SDK for Camtasia, and I'm looking at this file with this piece of code: 我正在为Camtasia创建一个SDK,并且正在用以下代码查看此文件:
"backgroundColor" : [239, 0, 191, 255]
Of course, I need to do more than this, but this is basically what I'm doing. 当然,我需要做的比这更多,但这基本上就是我正在做的。 I need to create the same thing but with c#.
我需要用c#创建相同的东西。 I cannot do this because it gives me an error:
我无法执行此操作,因为它给了我一个错误:
jobject.Add("backgroundColor", [239, 0, 191, 255]);
But when I wrap the value around quotes, when I convert it to a string, the value is wrapped around double quotes like this: 但是,当我用双引号将值引起来时,将其转换为字符串时,该值将用双引号引起来,如下所示:
"backgroundColor" : "[239, 0, 191, 255]"
But I can't have the value wrapped around double quotes because Camtasia can't read it, it needs it outside double quotes. 但是我无法将值括在双引号中,因为Camtasia无法读取它,它需要在双引号之外。
Can anyone help? 有人可以帮忙吗? I'll be glad to provide additional information if needed.
如果需要,我将很乐意提供其他信息。
When you are wrapping with "" - you are passing a string. 当用“”换行时-您正在传递字符串。 You need to pass array:
您需要传递数组:
jobject.Add("backgroundColor", new int[]{ 239, 0, 191, 255 });
Use a JArray 使用一个JArray
string[] parameterNames = new string[] { "Test1", "Test2", "Test3" };
JArray jarrayObj = new JArray();
foreach (string parameterName in parameterNames)
{
jarrayObj.Add(parameterName);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.