Z could be (a composed version of) Lazy<B>, so the copying only happens on first access.
Of course, if you need to cater for more than read only in the future, you may just want to rely on Z being an interface on B and on your programmers to not cast it to a Z unless they need write access. -- Regards, Mark Hurd, B.Sc.(Ma.)(Hons.) On 11 December 2015 at 10:12, Arjang Assadi <[email protected]> wrote: > Anyone knows whats a good way to refer to a underlying object's array > property in through the wrapper class? > > Suppose We have vlasses A and B where B is a an array propery of A as such > Let W be Wrapper for A and Z be wrapper for B then > > class A > { > public Property B[] DataArray{get;set;} > } > > in the Wrapper class I have > > class W > { > private A underlyingobject; > > public Property Z[] DataArray{get;set;} //what is a way to implement this > without copying the array of B //into W and convert them all, instead > having them yielded as if they were in W trough A and then //converted to Z > ? these operations are read only for now. > > } > > class Z > { > private B underlyingobject; > } > > Any patterns relating to this in C#? >
