mtreit
mtreit
CC#
Created by Adise on 4/6/2025 in #help
✅ Class instance reference
Like a classic bug is this:
public struct Point
{
public int X { get; set; }
public int Y { get; set; }
}

public class Widget
{
public Point Location { get; set; }
}
public struct Point
{
public int X { get; set; }
public int Y { get; set; }
}

public class Widget
{
public Point Location { get; set; }
}
and then you have code like this:
var w = new Widget();
w.Location.X = 42;
var w = new Widget();
w.Location.X = 42;
...and it doesn't get "updated" because of copy semantics with value types.
55 replies
CC#
Created by Adise on 4/6/2025 in #help
✅ Class instance reference
Unless you have some struct copy thing happening.
55 replies
CC#
Created by Adise on 4/6/2025 in #help
✅ Class instance reference
I think you are either doing something wrong or completely mis-diagnosing the issue because changing the value of a member of a reference type will absolutely update the instance being referred to 🙂
55 replies
CC#
Created by Adise on 4/6/2025 in #help
✅ Class instance reference
Variable capture in a closure could be an issue, yeah.
55 replies
CC#
Created by Adise on 4/6/2025 in #help
✅ Class instance reference
Then the reference you are using is to change the value of the member must be pointing to a different instance.
55 replies
CC#
Created by Adise on 4/6/2025 in #help
✅ Class instance reference
There is no "snapshot" behavior for reference types.
55 replies
CC#
Created by Adise on 4/6/2025 in #help
✅ Class instance reference
Unless I'm missing something.
55 replies
CC#
Created by Adise on 4/6/2025 in #help
✅ Class instance reference
What you are describing only makes sense if it's a struct.
55 replies
CC#
Created by Adise on 4/6/2025 in #help
✅ Class instance reference
Is UdpConnection a struct?
55 replies
CC#
Created by Adise on 4/6/2025 in #help
✅ Class instance reference
I read this multiple times and don't quite understand what you are saying the problem is.
55 replies
CC#
Created by quarterwire on 3/31/2025 in #help
✅ LEARN C# in 2025
I have no opinion on Unity but it uses an older non-modern version of .NET and C# and folks here who are familiar with it say don't try to learn Unity until you have a good grasp of C# itself.
44 replies
CC#
Created by quarterwire on 3/31/2025 in #help
✅ LEARN C# in 2025
It's just terrible.
44 replies
CC#
Created by quarterwire on 3/31/2025 in #help
✅ LEARN C# in 2025
Avoid the Yellow Book at all costs.
44 replies
CC#
Created by quarterwire on 3/31/2025 in #help
✅ LEARN C# in 2025
I probably learned C# before you were born so I'm not too up to speed on the most recent books, but The C# Players Guide and Head First C# both have good reputations.
44 replies
CC#
Created by quarterwire on 3/31/2025 in #help
✅ LEARN C# in 2025
And if you are starting out any recent book should be fine. It might not cover 100% of the latest features of the language but as a beginner you don't need those anyway.
44 replies
CC#
Created by quarterwire on 3/31/2025 in #help
✅ LEARN C# in 2025
Do what works best for you.
44 replies
CC#
Created by quarterwire on 3/31/2025 in #help
✅ LEARN C# in 2025
Everyone learns differently.
44 replies
CC#
Created by quarterwire on 3/31/2025 in #help
✅ LEARN C# in 2025
I prefer to learn from books myself.
44 replies
CC#
Created by Paul on 3/20/2025 in #help
Visual Studio includes only x86 dlls in build
I haven't built an MSI in about 20 years so no idea about that 🙂
62 replies
CC#
Created by Paul on 3/20/2025 in #help
Visual Studio includes only x86 dlls in build
Something must be different.
62 replies