Skip to content

Commit c6c9997

Browse files
committed
Added generic methods.
1 parent 8a60171 commit c6c9997

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

Scripts/Form.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,27 @@ public string ToJSON()
130130

131131
}
132132

133+
public string ToJSON<T>() where T : class, new()
134+
{
135+
136+
return JsonConvert.SerializeObject(GetFormValues<T>());
137+
138+
}
139+
133140
public void LoadFromJSON(string json)
134141
{
135142

136143
LoadFormRawValues(JsonConvert.DeserializeObject<Dictionary<string, object>>(json));
137144

138145
}
139146

147+
public void LoadFromJSON<T>(string json)
148+
{
149+
150+
LoadFormValues(JsonConvert.DeserializeObject<T>(json));
151+
152+
}
153+
140154
public void LoadFormRawValues(Dictionary<string, object> values)
141155
{
142156

0 commit comments

Comments
 (0)