Click here to Skip to main content
14,209,465 members
   

C#

 
QuestionUsing different versions of Visual Studio Pin
Brian_TheLion9-Mar-19 19:37
memberBrian_TheLion9-Mar-19 19:37 
AnswerRe: Using different versions of Visual Studio Pin
OriginalGriff9-Mar-19 19:57
protectorOriginalGriff9-Mar-19 19:57 
GeneralRe: Using different versions of Visual Studio Pin
Brian_TheLion9-Mar-19 23:25
memberBrian_TheLion9-Mar-19 23:25 
GeneralRe: Using different versions of Visual Studio Pin
OriginalGriff9-Mar-19 23:30
protectorOriginalGriff9-Mar-19 23:30 
GeneralRe: Using different versions of Visual Studio Pin
Brian_TheLion9-Mar-19 23:50
memberBrian_TheLion9-Mar-19 23:50 
GeneralRe: Using different versions of Visual Studio Pin
OriginalGriff9-Mar-19 23:51
protectorOriginalGriff9-Mar-19 23:51 
QuestionReference type copy change in foreach Pin
Member 130741338-Mar-19 12:30
memberMember 130741338-Mar-19 12:30 
AnswerRe: Reference type copy change in foreach Pin
Dave Kreskowiak8-Mar-19 13:35
mveDave Kreskowiak8-Mar-19 13:35 
I have no idea what you're trying to.

But, there a problems with the code in general. First, you never make a copy of the object line is pointing to.

Next, you create a new variable, copyline, and point it a new instance of LineTable. On the very next line of code you throw that instance out. ???
foreach (var line in Lines)
{
    var copyline = new LineTable();
    copyline = line;


On the same line, you point copyline to the same object line is pointing to. This does NOT make a copy of an object!
copyline = line;


Then you start manipulating the properties of the object pointed to by copyline. Well, both line and copyline are pointing at the exact same object so the changes you make with one variable will show up in the other.

So, yeah, ReferenceEquals is going to return true.

If you're trying to make a copy of line, you're going to have to define exactly what you want to copy. A "shallow copy" can easily be done using MemberwiseClone(). A "deep copy" is quite a bit more complex, and can be done many different ways depending on what members of line you're copying and how.

QuestionIonic.Zip Date Problems. Pin
ormonds7-Mar-19 17:30
memberormonds7-Mar-19 17:30 
AnswerRe: Ionic.Zip Date Problems. Pin
Dave Kreskowiak8-Mar-19 3:58
mveDave Kreskowiak8-Mar-19 3:58 
GeneralRe: Ionic.Zip Date Problems. Pin
ormonds10-Mar-19 11:31
memberormonds10-Mar-19 11:31 
Questionwpf proble with DataGridTextColumn.HeaderTemplate Pin
Member 45620987-Mar-19 6:03
memberMember 45620987-Mar-19 6:03 
AnswerRe: wpf proble with DataGridTextColumn.HeaderTemplate Pin
OriginalGriff7-Mar-19 6:40
protectorOriginalGriff7-Mar-19 6:40 
AnswerRe: wpf proble with DataGridTextColumn.HeaderTemplate Pin
Gerry Schmitz7-Mar-19 7:13
mveGerry Schmitz7-Mar-19 7:13 
QuestionBest way of remembering the history of treeview and other control also across the application in desktop application Pin
Member 101628907-Mar-19 5:23
memberMember 101628907-Mar-19 5:23 
AnswerRe: Best way of remembering the history of treeview and other control also across the application in desktop application Pin
Richard MacCutchan7-Mar-19 5:32
protectorRichard MacCutchan7-Mar-19 5:32 
AnswerRe: Best way of remembering the history of treeview and other control also across the application in desktop application Pin
Eddy Vluggen7-Mar-19 11:35
mveEddy Vluggen7-Mar-19 11:35 
AnswerRe: Best way of remembering the history of treeview and other control also across the application in desktop application Pin
BillWoodruff8-Mar-19 17:11
mveBillWoodruff8-Mar-19 17:11 
GeneralRe: Best way of remembering the history of treeview and other control also across the application in desktop application Pin
Member 1016289011-Mar-19 21:43
memberMember 1016289011-Mar-19 21:43 
GeneralRe: Best way of remembering the history of treeview and other control also across the application in desktop application Pin
BillWoodruff11-Mar-19 21:50
mveBillWoodruff11-Mar-19 21:50 
GeneralRe: Best way of remembering the history of treeview and other control also across the application in desktop application Pin
Member 1016289013-Mar-19 5:59
memberMember 1016289013-Mar-19 5:59 
GeneralRe: Best way of remembering the history of treeview and other control also across the application in desktop application Pin
BillWoodruff13-Mar-19 6:44
mveBillWoodruff13-Mar-19 6:44 
QuestionCan classes be nested Pin
Brian_TheLion6-Mar-19 17:26
memberBrian_TheLion6-Mar-19 17:26 
AnswerRe: Can classes be nested Pin
BillWoodruff6-Mar-19 19:37
mveBillWoodruff6-Mar-19 19:37 
GeneralRe: Can classes be nested Pin
Ralf Meier7-Mar-19 0:08
professionalRalf Meier7-Mar-19 0:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Cookies | Terms of Service
Web01 | 2.8.190617.3 | Last Updated 17 Jun 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid