C
C#15mo ago
Zomboos

❔ getproperties reset object properties to 0

9 Replies
Azrael
Azrael15mo ago
What?
Zomboos
ZomboosOP15mo ago
so in visual studio i kept track of all the properties and they all exist untill the getproperties where they suddenly dissapear
Anu6is
Anu6is15mo ago
you vehicle class uses fields not properties
Zomboos
ZomboosOP15mo ago
ow haha thats probally where it went wrong how can i change my fields into properties then
ransomink
ransomink15mo ago
i'd look at a tutorial on how to create properties in c#. it's a beginner topic you should learn about . . .
Angius
Angius15mo ago
$structure
MODiX
MODiX15mo ago
namespace Namespace;

[Attribute]
public class Class
{
public string PublicField;
private bool _privateField;
protected double protectedField;

public int PublicProperty { get; set; }

public Class() {} // Constructor

public void Method(int parameter)
{
var localVariable = parameter;
}
}
namespace Namespace;

[Attribute]
public class Class
{
public string PublicField;
private bool _privateField;
protected double protectedField;

public int PublicProperty { get; set; }

public Class() {} // Constructor

public void Method(int parameter)
{
var localVariable = parameter;
}
}
For C# versions older than 10, see $StructureOld
Zomboos
ZomboosOP15mo ago
Alright thank you all, il look into them
Accord
Accord15mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server