1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Newtonsoft.Json;
- using Newtonsoft.Json.Linq;
- namespace cuidian.OpenApi.Utils
- {
- public class ApiList
- {
- private JArray array;
- public ApiList(JArray array)
- {
- this.array = array;
- }
- public JArray GetJArray()
- {
- return array;
- }
- public IList GetArray()
- {
- return array;
- }
- public int Count
- {
- get { return array.Count; }
- }
- public ApiDictionary this[int index]
- {
- get { return this.GetObject(index); }
- }
- public ApiDictionary GetObject(int index)
- {
- Type t = array[index].GetType();
- if (t.FullName.Equals("Newtonsoft.Json.Linq.JObject", StringComparison.CurrentCultureIgnoreCase))
- {
- return JsonConvert.DeserializeObject<ApiDictionary>(array[index].ToString());
- }
- return null;
- }
- public override string ToString()
- {
- return JsonConvert.SerializeObject(array);
- }
- }
- }
|