看板 C_Sharp 關於我們 聯絡資訊
// 前文恕刪 // 雖不是很懂原Po的需求, 不過還是隔空抓藥寫個雛形給原Po public struct Point { public int X { get; set; } public int Y { get; set; } } public class PropertyPoints { private IList<Point> _points; public PropertyPoints(string property) { _points = new List<Point>(); Property = property; } public string Property { get; set; } public IList<Point> Points { get { return _points; } } // 05/12修正 } public class Data { private IDictionary<string, PropertyPoints> _propertyPointsMap; public Data() { _propertyPointsMap = new Dictionary<string, PropertyPoints>(); } public void Add(string property, int x, int y) { if (_propertyPointsMap.ContainsKey(property)) { _propertyPointsMap[property].Points.Add( new Point() { X = x, Y = y } ); } else { PropertyPoints propertyPoints = new PropertyPoints(property); propertyPoints.Points.Add(new Point() { X = x, Y = y }); _propertyPointsMap.Add(property, propertyPoints); } } } // 05/12修正 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.120.150.76
conanist:可能你要打個注解 不然原po會看不懂 05/12 14:44
※ 編輯: flamo 來自: 114.24.152.237 (05/12 20:35)
flamo:修正bug 05/12 20:36
※ 編輯: flamo 來自: 114.24.152.237 (05/12 20:37)