/// <summary> /// Overrides existing size with name as provided size with new values. Adds if the size doesn't exist /// </summary> public static void UpdateOrInsertSize(this IList <PictureSize> pictureSizes, PictureSize size) { if (pictureSizes == null) { throw new mobSocialException("Can't map size to null collection"); } if (size == null) { return; } var pictureSize = pictureSizes.FirstOrDefault(x => x.Name == size.Name); if (pictureSize == null) { MapSize(pictureSizes, size); } else { //assign new values pictureSize.Width = size.Width; pictureSize.Height = size.Height; //clear resource size.Dispose(); } }
/// <summary> /// Overrides existing size with name as provided size with new values. Adds if the size doesn't exist /// </summary> public static void UpdateOrInsertSize(this IList<PictureSize> pictureSizes, PictureSize size) { if (pictureSizes == null) throw new mobSocialException("Can't map size to null collection"); var pictureSize = pictureSizes.FirstOrDefault(x => x.Name == size.Name); if (pictureSize == null) MapSize(pictureSizes, size); else { //assign new values pictureSize.Width = size.Width; pictureSize.Height = size.Height; //clear resource size.Dispose(); } }