16,004,192 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 10040991 (Top 11 by date)
Member 10040991
17-Sep-13 7:28am
View
The correct call to the method is:
MoveUiP = (List < unitsinplaydata > )DeepClone(UiP);
I was missing a cast. This works perfectly. There is a split second delay in moving units on the map, but I think it is acceptable.
Member 10040991
17-Sep-13 7:11am
View
OK - I had to add using System.Xml; and a dll reference to the project for System.Runtime.Serialization. Now the compiler error says that serializer.PreserveObjectReferences is read-only and can't be assigned to true. I'm assuming I can remark that line out?
Member 10040991
17-Sep-13 6:57am
View
I'm liking this deep clone serializer, but what is the correct syntax to call it? I'm guessing it would be simply MoveUiP = DeepClone(UiP); ?? I'm assuming I have permission to use it? I've been working with C# for about 6 months now on a full time basis and there is a lot to learn and understand. You guys have been a great help, even though most of this is way over my head. Thanks.
Member 10040991
17-Sep-13 6:42am
View
Like the example I provided above, just 40+ items. No nested classes, just basic variables. I suppose I could try the serializable approach, but wasn't sure the int[] array and bool would translate easily.
Member 10040991
16-Sep-13 20:58pm
View
I reuse MoveUiP and have to clear it out. Did I get the example backwards? As I understand it it cycles thru each element of UiP and adds i to MoveUiP?
I just found this code:
var source = new List<string>();
// populate...
var copy = source.Select(x=>string.Copy(x));
But I need to replace the string.Copy with UnitsInPlayData.Copy and I have nothing written in the UnitsInPlayData for a Copy method. Might I add Icloneable to the class and have a Copy method that returns a memberwise clone?
I'll look at this again tomorrow, its getting late. You have been a lot of help so far, I just don't understand it yet. Thanks for sticking with me.
Member 10040991
16-Sep-13 20:25pm
View
I was hoping that this little code bit would do the job:
MoveUiP.Clear();
UiP.ForEach(i => MoveUiP.Add(i));
But, unfortunately, it doesn't work. Both contain the same data when I debug.
Making a copy of an object shouldn't be this difficult.
I will have to study your code more, its not obvious to me how to make it work with my list classes. I don't get the Parent Child section of your code, I don't think I have a child in mine.
Member 10040991
16-Sep-13 19:46pm
View
This is way more complicated and generic than I was looking for. I only have two lists I want to make clones of. It is also hard for me to see how to implement this with my list class, which is the problem I've had with ALL the other examples I've looked at. I'm looking for something concise like: MoveUiP = UiP.Clone(); but I don't see how I can get to that using the code you have provided. Your implicit clone requires that I enumerate all 40+ of my classes attributes, which isn't an option I'm looking for. Is there an easier way?
Member 10040991
16-Sep-13 17:28pm
View
I took all my botched attempts out and provided the code I started with.
Member 10040991
29-May-13 16:54pm
View
Cloning the image was just the start of the fix. I cloned the passimage from the image I needed. Then in the function, I immediately cloned it to the return image and disposed of the passimage. I switched all the background commands to the third image, some were using the second. Then I disposed of the third image just before calling for its update.
Member 10040991
28-May-13 21:52pm
View
Yes, well, there is a lot of code, and in several places. I pass one of the images to a function and get the overlaid image back - but apparently the original image is getting changed in the process. I'll see if I have an example.
Member 10040991
16-May-13 14:57pm
View
Yes, I thought about that - dragging 10 menustrips onto the form and making them invisible until needed, but wasn't sure that was the best way to do it. I forgot about the form being a partial class, I'll see if I can get that to do what I want. Thanks
Show More