您认为什么是最简洁的方式来循环访问img.Group.Contents
并将值写入galleryImage。对象?你会如何简化这种映射? Array to objects
galleryImage.TinyImage = new myModel.Image._Img();
galleryImage.TinyImage.Url = img.Group.Contents[0].Url;
galleryImage.TinyImage.FileSize = img.Group.Contents[0].FileSize;
galleryImage.TinyImage.Type = img.Group.Contents[0].Type;
galleryImage.TinyImage.Medium = img.Group.Contents[0].Medium;
galleryImage.TinyImage.Width = img.Group.Contents[0].Width;
galleryImage.TinyImage.Height = img.Group.Contents[0].Height;
galleryImage.TinyImage.Hash = img.Group.Contents[0].Hash;
galleryImage.Thumbnail.Url = img.Group.Contents[1].Url;
galleryImage.Thumbnail.FileSize = img.Group.Contents[1].FileSize;
galleryImage.Thumbnail.Type = img.Group.Contents[1].Type;
galleryImage.Thumbnail.Medium = img.Group.Contents[1].Medium;
galleryImage.Thumbnail.Width = img.Group.Contents[1].Width;
galleryImage.Thumbnail.Height = img.Group.Contents[1].Height;
galleryImage.Thumbnail.Hash = img.Group.Contents[1].Hash;
galleryImage.SmallImage.Url = img.Group.Contents[2].Url;
galleryImage.SmallImage.FileSize = img.Group.Contents[2].FileSize;
galleryImage.SmallImage.Type = img.Group.Contents[2].Type;
galleryImage.SmallImage.Medium = img.Group.Contents[2].Medium;
galleryImage.SmallImage.Width = img.Group.Contents[2].Width;
galleryImage.SmallImage.Height = img.Group.Contents[2].Height;
galleryImage.SmallImage.Hash = img.Group.Contents[2].Hash;
galleryImage.MediumImage.Url = img.Group.Contents[3].Url;
galleryImage.MediumImage.FileSize = img.Group.Contents[3].FileSize;
galleryImage.MediumImage.Type = img.Group.Contents[3].Type;
galleryImage.MediumImage.Medium = img.Group.Contents[3].Medium;
galleryImage.MediumImage.Width = img.Group.Contents[3].Width;
galleryImage.MediumImage.Height = img.Group.Contents[3].Height;
galleryImage.MediumImage.Hash = img.Group.Contents[3].Hash;
galleryImage.LargeImage.Url = img.Group.Contents[4].Url;
galleryImage.LargeImage.FileSize = img.Group.Contents[4].FileSize;
galleryImage.LargeImage.Type = img.Group.Contents[4].Type;
galleryImage.LargeImage.Medium = img.Group.Contents[4].Medium;
galleryImage.LargeImage.Width = img.Group.Contents[4].Width;
galleryImage.LargeImage.Height = img.Group.Contents[4].Height;
galleryImage.LargeImage.Hash = img.Group.Contents[4].Hash;
galleryImage.ExtraLargeImage.Url = img.Group.Contents[5].Url;
galleryImage.ExtraLargeImage.FileSize = img.Group.Contents[5].FileSize;
galleryImage.ExtraLargeImage.Type = img.Group.Contents[5].Type;
galleryImage.ExtraLargeImage.Medium = img.Group.Contents[5].Medium;
galleryImage.ExtraLargeImage.Width = img.Group.Contents[5].Width;
galleryImage.ExtraLargeImage.Height = img.Group.Contents[5].Height;
galleryImage.ExtraLargeImage.Hash = img.Group.Contents[5].Hash;
我已经发布了我的最终代码作为单独的答案,但我基本上使用了你的方向。谢谢。 –