async public Task <List <IDatasetElement> > Elements() { if (_layers == null || _layers.Count == 0) { _layers = await _fdb.DatasetLayers(this); if (_layers != null && _addedLayers.Count != 0) { List <IDatasetElement> list = new List <IDatasetElement>(); foreach (IDatasetElement element in _layers) { if (element is IFeatureLayer) { if (_addedLayers.Contains(((IFeatureLayer)element).FeatureClass.Name)) { list.Add(element); } } else if (element is IRasterLayer) { if (_addedLayers.Contains(((IRasterLayer)element).Title)) { list.Add(element); } } else { if (_addedLayers.Contains(element.Title)) { list.Add(element); } } } _layers = list; } } if (_layers == null) { return(new List <IDatasetElement>()); } return(_layers); }