Waffen
Waffen
CC#
Created by Waffen on 5/22/2023 in #help
❔ Deep clone variable
Thanks a lot! I did not know how to correctly formulate my problem, what to correctly google the solution. Deep clone through Serialize and deserialize helps me and takes 0.0758792 seconds. For my project, this delay is not a problem.
86 replies
CC#
Created by Waffen on 5/22/2023 in #help
❔ Deep clone variable
Okey
86 replies
CC#
Created by Waffen on 5/22/2023 in #help
❔ Deep clone variable
I've tried this variant already, it stil True
86 replies
CC#
Created by Waffen on 5/22/2023 in #help
❔ Deep clone variable
What "2nd variant" are you talking about?
86 replies
CC#
Created by Waffen on 5/22/2023 in #help
❔ Deep clone variable
I'm not sure if this method is right for my problem
86 replies
CC#
Created by Waffen on 5/22/2023 in #help
❔ Deep clone variable
Yes, but is there any other variants?
86 replies
CC#
Created by Waffen on 5/22/2023 in #help
❔ Deep clone variable
serialize then deserialize the best method for me i guess.
86 replies
CC#
Created by Waffen on 5/22/2023 in #help
❔ Deep clone variable
I needed just a method how to do deep copy
86 replies
CC#
Created by Waffen on 5/22/2023 in #help
❔ Deep clone variable
changed example for you:
var r1 = new SomeRecord("", 0);
var r2 = r1 with {};
// do some changes with r2
if (r1 == r2) <-- True
var r1 = new SomeRecord("", 0);
var r2 = r1 with {};
// do some changes with r2
if (r1 == r2) <-- True
86 replies
CC#
Created by Waffen on 5/22/2023 in #help
❔ Deep clone variable
let me try this method firstly
86 replies
CC#
Created by Waffen on 5/22/2023 in #help
❔ Deep clone variable
var r1 = new SomeRecord("", 0);
var r2 = r1 with {};
// do some changes with r2
if (r1 == r2) <-- True
var r1 = new SomeRecord("", 0);
var r2 = r1 with {};
// do some changes with r2
if (r1 == r2) <-- True
86 replies
CC#
Created by Waffen on 5/22/2023 in #help
❔ Deep clone variable
Due to some I can't get these changes directly
86 replies
CC#
Created by Waffen on 5/22/2023 in #help
❔ Deep clone variable
Ok, it doesn't work. It made copy, but it still changes two variables
86 replies
CC#
Created by Waffen on 5/22/2023 in #help
❔ Deep clone variable
I need to make a copy of the UserProfile then make some changes to it then I need to compare oldProfile and newProfile and get this difference
86 replies
CC#
Created by Waffen on 5/22/2023 in #help
❔ Deep clone variable
Hm, thanks, let me try record before. But serialize then deserialize method sounds very good.
86 replies
CC#
Created by Waffen on 5/22/2023 in #help
❔ Deep clone variable
¯\_(ツ)_/¯
86 replies
CC#
Created by Waffen on 5/22/2023 in #help
❔ Deep clone variable
Let me try
86 replies
CC#
Created by Waffen on 5/22/2023 in #help
❔ Deep clone variable
My code is too big, i can't send it here
86 replies
CC#
Created by Waffen on 5/22/2023 in #help
❔ Deep clone variable
It is just example
86 replies
CC#
Created by Waffen on 5/22/2023 in #help
❔ Deep clone variable
or use records that you can copy using with {} Do you mean this variant?
public object Clone()
{
return new Person { Name = this.Name, Age = this.Age };
}
public object Clone()
{
return new Person { Name = this.Name, Age = this.Age };
}
86 replies