public static ObservableDeck AsObservable(this IDeck deck) { if (deck == null) return null; var ret = new ObservableDeck(); ret.GameId = deck.GameId; ret.IsShared = deck.IsShared; if (deck.Sections == null) ret.Sections = new List<ObservableSection>(); else { ret.Sections = deck.Sections .Where(x => x != null) .Select( x => { var sret = new ObservableSection(); sret.Name = (x.Name ?? "").Clone() as string; if(x.Cards == null) sret.Cards = new List<ObservableMultiCard>(); else sret.Cards = x.Cards.Where(y=> y != null).Select(y => y.AsObservable()).ToArray(); sret.Shared = x.Shared; return sret; }); } ret.Notes = (deck.Notes ?? "").Clone() as string; return ret; }
public static ObservableDeck AsObservable(this IDeck deck) { if (deck == null) return null; var ret = new ObservableDeck { GameId = deck.GameId, IsShared = deck.IsShared, Sections = deck.Sections.Select(x => new ObservableSection() { Name = x.Name.Clone() as string, Cards = x.Cards.Select(y => y.AsObservable()).ToArray(), Shared = x.Shared }), Notes = deck.Notes.Clone() as string }; return ret; }
public static ObservableDeck AsObservable(this IDeck deck) { if (deck == null) return null; var ret = new ObservableDeck { GameId = deck.GameId, IsShared = deck.IsShared, Sections = deck.Sections }; return ret; }