vdvman1
vdvman1
CC#
Created by DaVinki on 6/19/2023 in #help
❔ Does the C# version matter for a netstandard2.1 library?
Most likely, yeah, but still something to keep in mind just in case
10 replies
CC#
Created by DaVinki on 6/19/2023 in #help
❔ Does the C# version matter for a netstandard2.1 library?
Yeah you need to be careful not to use any language features that require runtime changes, but otherwise it should work fine
10 replies
CC#
Created by TigerThePleb on 4/5/2023 in #help
Implement string properties
Whether you use: - string and string.Empty - string? and null - string and the required keyword - string and initialise it in the constructor Depends on what values you want the property to hold and how you want it to be set the first time
30 replies
CC#
Created by TigerThePleb on 4/5/2023 in #help
Implement string properties
If you wanted to allow Prop to have a null value, use string? instead of string, and then you can remove the !
30 replies
CC#
Created by TigerThePleb on 4/5/2023 in #help
Implement string properties
The first two are equivalent, they use an empty string as the default value The last makes it null instead of an empty string, and since you're using ! it looks like you are using nullable reference types, and since you're storing null into a property that states it isn't null you are potentially going to cause issues
30 replies
CC#
Created by jakub on 3/27/2023 in #help
❔ As loop value increments, increment variable name
Employee[] employees = new Employee[5];
for (int i = 0; i < employees.Length; ++i)
{
employees[i] = new Employee(...);
...
}
Employee[] employees = new Employee[5];
for (int i = 0; i < employees.Length; ++i)
{
employees[i] = new Employee(...);
...
}
6 replies
CC#
Created by jakub on 3/27/2023 in #help
❔ As loop value increments, increment variable name
No, but you could store the employees in an array instead of separate variables
6 replies
CC#
Created by Avis on 2/20/2023 in #help
How do I call the constructor of a parent class?
What makes you say that?
19 replies
CC#
Created by Avis on 2/20/2023 in #help
How do I call the constructor of a parent class?
abstract class Parent
{
public Parent(string mom, string dad)
{
...
}
}

public class Child : Parent
{
public Child(string mom, string dad)
: base(mom, dad)
{
...
}
}
abstract class Parent
{
public Parent(string mom, string dad)
{
...
}
}

public class Child : Parent
{
public Child(string mom, string dad)
: base(mom, dad)
{
...
}
}
19 replies
CC#
Created by moshimoshi on 2/14/2023 in #help
❔ Understanding guidelines around use of 'bool'
Also not all while loops will even use a bool variable
12 replies
CC#
Created by moshimoshi on 2/14/2023 in #help
❔ Understanding guidelines around use of 'bool'
Which "leaves the loop" is entirely dependent on how you write the condition inside the while(...)
12 replies