현재 실현 가능하지 않습니다. JSONData에서
public enum JSONBinaryTag
{
Array = 1,
Class = 2,
Value = 3,
IntValue = 4,
DoubleValue = 5,
BoolValue = 6,
FloatValue = 7,
LongValue = 8,
String = 9, // <-- new
Number = 10 // <-- new
}
그리고 추가 유형 검사 :
그래서 난 새로운 유형의 추가
public class JSONData : JSONNode{
static Regex m_Regex = new Regex(@"^[0-9]*(?:\.[0-9]*)?$");
private JSONBinaryTag m_Type = JSONBinaryTag.String;
private string m_Data;
public override string Value {
get { return m_Data; }
set { m_Data = value; }
}
public JSONData(string aData){
m_Data = aData;
// check for number
if (m_Regex.IsMatch(m_Data))
m_Type = JSONBinaryTag.Number;
else
m_Type = JSONBinaryTag.String;
}
[...]
}
을 그리고 toString()
방법을 변경 :
public override string ToString(){
if (m_Type == JSONBinaryTag.String)
return "\"" + Escape(m_Data) + "\"";
else
return Escape(m_Data);
}
이제 int
, float
, double
것 0123없이 번호로 추가된다.. 그러면 다음과 같이 보일 것입니다 : {"attr" : 4}
나는 그것이 반사의 느린 '원인을 생각하여 사용할 수 있습니다. – Suvitruf