Click here to Skip to main content
15,902,198 members
Home / Discussions / C#
   

C#

 
QuestionUsing different versions of Visual Studio Pin
Brian_TheLion9-Mar-19 19:37
Brian_TheLion9-Mar-19 19:37 
AnswerRe: Using different versions of Visual Studio Pin
OriginalGriff9-Mar-19 19:57
mveOriginalGriff9-Mar-19 19:57 
GeneralRe: Using different versions of Visual Studio Pin
Brian_TheLion9-Mar-19 23:25
Brian_TheLion9-Mar-19 23:25 
GeneralRe: Using different versions of Visual Studio Pin
OriginalGriff9-Mar-19 23:30
mveOriginalGriff9-Mar-19 23:30 
GeneralRe: Using different versions of Visual Studio Pin
Brian_TheLion9-Mar-19 23:50
Brian_TheLion9-Mar-19 23:50 
GeneralRe: Using different versions of Visual Studio Pin
OriginalGriff9-Mar-19 23:51
mveOriginalGriff9-Mar-19 23:51 
QuestionReference type copy change in foreach Pin
Member 130741338-Mar-19 12:30
Member 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. ???
C#
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!
C#
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
ormonds7-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
ormonds10-Mar-19 11:31 
Questionwpf proble with DataGridTextColumn.HeaderTemplate Pin
Member 45620987-Mar-19 6:03
Member 45620987-Mar-19 6:03 
AnswerRe: wpf proble with DataGridTextColumn.HeaderTemplate Pin
OriginalGriff7-Mar-19 6:40
mveOriginalGriff7-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
Member 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
mveRichard 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
professionalEddy 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
professionalBillWoodruff8-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
Member 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
professionalBillWoodruff11-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
Member 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
professionalBillWoodruff13-Mar-19 6:44 
QuestionCan classes be nested Pin
Brian_TheLion6-Mar-19 17:26
Brian_TheLion6-Mar-19 17:26 
AnswerRe: Can classes be nested Pin
BillWoodruff6-Mar-19 19:37
professionalBillWoodruff6-Mar-19 19:37 
GeneralRe: Can classes be nested Pin
Ralf Meier7-Mar-19 0:08
mveRalf 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.