Dinosaure
Dinosaure
CC#
Created by Roofboy on 10/10/2024 in #help
Partial view not found in Razor Pages despite being in the correct location
Are you sure _NewPost.cshtml is actually part of the build solution?
2 replies
CC#
Created by zzz on 10/11/2024 in #help
changing a boolean value outside a loop from inside a loop
@zzz if you want to briefly test some C# code, you can use sharplab.io, it’s an online dev pad, where you'll find nearly everything you need for proof of concepts.
24 replies
CC#
Created by zzz on 10/11/2024 in #help
changing a boolean value outside a loop from inside a loop
As stated, when a duplicate is found, count2 is incremented once; then, the condition for the bool change is count2 > 1, which won’t happen ever. Maybe the condition could be count2 >= 1? Or maybe you can use LINQ, with bool duplicate = nums.ToLookup(n => n).Any(g => g.Count() > 1); (requires using System.Linq as a header), instead of the entire while block?
24 replies
CC#
Created by Yasu on 10/9/2024 in #help
✅ can somebody help me learn about smtp so i can make a email message sender please
Have you searched for resources online before posting here? SmtpClient examples Edit :
We don't recommend that you use the SmtpClient class for new development because SmtpClient doesn't support many modern protocols. Use MailKit or other libraries instead.
6 replies
CC#
Created by Merineth 🇸🇪 on 10/9/2024 in #help
Creating a class Player based on instructions
If you need help for the C#, you can ask here aswell.
97 replies
CC#
Created by Merineth 🇸🇪 on 10/9/2024 in #help
Creating a class Player based on instructions
You should have a look at alignments to have a better pov on the dynamic layering.
97 replies
CC#
Created by Merineth 🇸🇪 on 10/9/2024 in #help
Creating a class Player based on instructions
Because your grid has a fixed width. If your (outermost) container doesn't have a width of *, it may not resize with the window size.
97 replies
CC#
Created by Merineth 🇸🇪 on 10/9/2024 in #help
Creating a class Player based on instructions
You can have a row "spanned" across multiple columns, with something like "colspan=2", or likewise.
97 replies
CC#
Created by Merineth 🇸🇪 on 10/9/2024 in #help
Creating a class Player based on instructions
Ooh, I see.
97 replies
CC#
Created by Merineth 🇸🇪 on 10/9/2024 in #help
Creating a class Player based on instructions
+I kind of think ComputerPlayerwill have to set its Disk aswell?
97 replies
CC#
Created by Merineth 🇸🇪 on 10/9/2024 in #help
Creating a class Player based on instructions
As the enum is inside the Player class, you may have trouble accessing it when building a new HumanPlayer. Maybe you should extract it elsewhere, to make it more globally available?
97 replies
CC#
Created by Merineth 🇸🇪 on 10/9/2024 in #help
Creating a class Player based on instructions
Yes, but try to build it, the disk constructor argument should reflect the this.disk type.
97 replies
CC#
Created by Merineth 🇸🇪 on 10/9/2024 in #help
Creating a class Player based on instructions
Hmm, you should have your disk field typed as Diskcolor if you want to use the enum.
97 replies
CC#
Created by Merineth 🇸🇪 on 10/9/2024 in #help
Creating a class Player based on instructions
this.Disk = Disk; looks fine, is there a problem with it?
97 replies
CC#
Created by Merineth 🇸🇪 on 10/9/2024 in #help
Creating a class Player based on instructions
enum stands for "Enumeration". It's a type that contains information about possible values. You often find examples as enum WeekDay { Monday, Tuesday, ... }, that you can then use as reference in situation like WeekDay currentDay = WeekDay.Saturday;. In the case of player colors, maybe you would have enum PlayerColor { Blue, Red, Green, Yellow }.? If an enum isn't requested, you may also use already existing Color types from System.Drawing.Color.
97 replies
CC#
Created by maiker on 10/9/2024 in #help
Basic stuff: c#
Or if you just want to have an array of this WritingTools in PencilCase:
internal class WritingTool
{
private string name;
private string metrial;
private double price;
private bool isUsed;

}
internal class PencilCase
{
private WritingTool[] WritingTools = [];
}
internal class WritingTool
{
private string name;
private string metrial;
private double price;
private bool isUsed;

}
internal class PencilCase
{
private WritingTool[] WritingTools = [];
}
This would setup your WritingTool array.
9 replies
CC#
Created by maiker on 10/9/2024 in #help
Basic stuff: c#
If you just want to use the class as just an embedded class, you can do so:
internal class PencilCase
{
internal class WritingTool
{
public string name; //fields have to be public to be accessible outside
private string metrial;
private double price;
private bool isUsed;

}

private WritingTool MyWritingTool = new();
public string ExposeThatName() => MyWritingTool.name;
}
internal class PencilCase
{
internal class WritingTool
{
public string name; //fields have to be public to be accessible outside
private string metrial;
private double price;
private bool isUsed;

}

private WritingTool MyWritingTool = new();
public string ExposeThatName() => MyWritingTool.name;
}
9 replies
CC#
Created by maiker on 10/9/2024 in #help
Basic stuff: c#
Can I ask you what you mean by "using" the class inside the other? Because there are multiple use cases, and they have different outcomes.
9 replies
CC#
Created by mich4s on 10/8/2024 in #help
whats this, is this just console or .net console when creating a new project with visual studio 22?
Thanks for the reminder, both are strictly equivalent.
53 replies
CC#
Created by mich4s on 10/8/2024 in #help
whats this, is this just console or .net console when creating a new project with visual studio 22?
The namespace is file-bound on the right, block-bound on the left. It doesn’t change the code, and removes one indentation layer. Plus, as stated by @Pobiega, your Program is explicitly set to internal on the left, while kept implicitly internal (by default) on the right. So both are the same code.
53 replies