简体   繁体   English

我想知道此值的类型以及如何使用它?

[英]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.

相关问题 我想知道是否或如何使用标志枚举并在另一个类中返回枚举参数 - I want to know if or how I can use the flag enum and return the enum parameter in another class 如何获得所需的类型? - How can I get the type I want? 如何更改我想要使用的JIT类型 - How to change the type of JIT I want to use 我怎么知道我可以在GetRow()上强制转换为哪种类型? - How do I know what type I can cast to on a GetRow()? 如何使用“is”来确定参数的值是否为类的类型? - How can I use "is" to determine if the value of a parameter is a type of class? 我想知道如何在后面的代码中访问模态表单元素。我也想知道如何在模态表单上应用jquery验证器 - I want to know that how can i access my modal form elements in my code behind .Also I want to know how can I apply jquery validator on modal form 我想使用基类,但我不希望调用应用程序知道它该如何执行? C# - I want to use a base class but I dont want calling apps to know about it how do I do this? c# 我将如何使用HTMLAgilityPack提取所需的值 - How would I use HTMLAgilityPack to extract the value I want 如何知道图表中点(X,Y)的X值,如何知道YC#的值? - How I can know X value of point (X, Y) in chart and I know the value of Y C#? 我想使用 Mono。 Cecil 创建一个委托,但我不知道如何获取它的构造函数 - I want to use Mono. Cecil to create a delegate, but I don't know how to get its constructor
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM