Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

New Post: Generating new instance

$
0
0
I am trying to build up an array of objects, but when I use container.resolve<>(), it always uses the same instance, so I end up getting an array where the last object added is the same reference as all the other elements.
            ITCardGACCVM gacc1 = basecontainer.Resolve<ITCardGACCVM>();
            gacc1.GaccName = "NameOne";
            GaccList.Add(gacc1);

           ITCardGACCVM gacc2 = basecontainer.Resolve<ITCardGACCVM>();
            gacc2 .GaccName = "NameTwo";
            GaccList.Add(gacc2 );

 //Both elements in GaccList are the same reference, and have the name "NameTwo"
How can i use prism to generate a NEW COPY of a class? Thanks!

Viewing all articles
Browse latest Browse all 1878

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>