Click here to Skip to main content
15,917,177 members
Home / Discussions / C#
   

C#

 
QuestionCatch JavaScript errors Pin
dataminers11-Mar-19 0:43
dataminers11-Mar-19 0:43 
AnswerRe: Catch JavaScript errors Pin
OriginalGriff11-Mar-19 1:49
mveOriginalGriff11-Mar-19 1:49 
Rant[REPOST] Catch JavaScript errors Pin
Richard Deeming11-Mar-19 9:22
mveRichard Deeming11-Mar-19 9:22 
QuestionSizeF and InvariantCulture Pin
Bernhard Hiller11-Mar-19 0:38
Bernhard Hiller11-Mar-19 0:38 
AnswerRe: SizeF and InvariantCulture Pin
OriginalGriff11-Mar-19 1:59
mveOriginalGriff11-Mar-19 1:59 
GeneralRe: SizeF and InvariantCulture Pin
Bernhard Hiller11-Mar-19 4:19
Bernhard Hiller11-Mar-19 4:19 
GeneralRe: SizeF and InvariantCulture Pin
OriginalGriff11-Mar-19 4:56
mveOriginalGriff11-Mar-19 4:56 
AnswerRe: SizeF and InvariantCulture Pin
BillWoodruff11-Mar-19 22:04
professionalBillWoodruff11-Mar-19 22:04 
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 

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.