static IList createEntityListByHttpRequest(entityType type) { StreamReader reader = Toolkit.CreateHttpRequest(httpPath); Deserializer dsr = new Deserializer(); IList list = null; Type tp = null; switch (type) { case entityType.Measurement: tp = typeof(Measurement); list = new List <Measurement>(); break; case entityType.Measurements: tp = typeof(Measurements); list = new List <Measurement>(); break; } object obj = dsr.GetEntityData(tp, reader); Toolkit.CloseConnection(); switch (type) { case entityType.Measurement: list.Add(obj); break; case entityType.Measurements: list = (obj as Measurements).measurements; break; } return(list); }