Tempest
Tempest
CC#
Created by Tempest on 2/23/2025 in #help
How to tell if a variable is a reference or value data type
Yeah okay fair enough. I was reading msdn last night and learned that if your variable is less than or equal to 3 words a ref is bigger anyway. Okay, looking at my code base there are only a few instances where im passing anything larger than a primitive. I think I'll do some benchmarking today and see how big the performance hit to using in and out is because if its free or negligible there are only a few areas where it would be even vaguely appropriate anyway.
27 replies
CC#
Created by Tempest on 2/23/2025 in #help
How to tell if a variable is a reference or value data type
Contrived example of course, quite often the report is a lot smaller than the object it's a report of but there is still duplication
27 replies
CC#
Created by Tempest on 2/23/2025 in #help
How to tell if a variable is a reference or value data type
In could get rid of the report
27 replies
CC#
Created by Tempest on 2/23/2025 in #help
How to tell if a variable is a reference or value data type
Okay it's just I've been writing code like this lately: Class BankAccount{ Int balance } Class BankAccountReport{ Int balance } void displayBalance(BankAccountReport r){ } To get around accidentally changing variables I shouldn't be changing. I'm probably over engineering there but I'm trying to get better at writing secure code
27 replies
CC#
Created by Tempest on 2/23/2025 in #help
How to tell if a variable is a reference or value data type
Very true
27 replies
CC#
Created by Tempest on 2/23/2025 in #help
How to tell if a variable is a reference or value data type
yeah it might just be my old c++ brain, const was such a flexible keyword and we tended to use it everywhere, it felt like good practice back then but I'm aware that things have changed a lot in all that time
27 replies
CC#
Created by Tempest on 2/23/2025 in #help
How to tell if a variable is a reference or value data type
Do you know if there is any disadvantage to liberal use of the in and out keywords though? Besides the obvious fact that they restrict the way that you use variables
27 replies
CC#
Created by Tempest on 2/23/2025 in #help
How to tell if a variable is a reference or value data type
Okay cool thank you for your help. I think I'm starting to get the idea
27 replies
CC#
Created by Tempest on 2/23/2025 in #help
How to tell if a variable is a reference or value data type
Thank you, so if I use struct is it not garbage collected?
27 replies