MODiX
Updating/Deleting owned properties with EF Core and AutoMapper
* https://www.youtube.com/watch?v=T-EwN9UqRwE
* https://codeopinion.com/restructuring-to-a-vertical-slice-architecture/
* https://www.youtube.com/watch?v=ZA2X1gaAhJk
* https://www.youtube.com/watch?v=-mGRtMjws_8&t=975s
* https://www.youtube.com/watch?v=fnkzI9IxmOk
169 replies
Casting and Convert method in C#
When you don't know if a string is actually a number when handling user input, use
int.TryParse
(or variants, e.g. double.TryParse
)
TryParse
returns a bool
, where true
indicates successful parsing.
- Avoid int.Parse
if you do not know if the value parsed is definitely a number.
- Avoid Convert.ToInt32
entirely, this is an older method and Parse
should be preferred where you know the string can be parsed.
Read more here61 replies
Properties vs Fields in C#
Why use properties over a public field?
- Properties can individually specify access modifiers for get and set
- With Visual Studio, you can type prop, press tab and it will auto complete for you
- XAML requires properties for bindings
- Field exposure is really only done in readonly structs
- Using properties allows for future changes to the getter or setter without breaking your API/external programs (binary compatibility)
Example of an auto property:
Example of a property with backing field:
16 replies
Convert List to index to be used in an array
If your code is too long, you can post to https://paste.mod.gg/, save, and copy the link into chat for others to see your shared code!
52 replies
hello
Get started in 3 high level steps...
1. Download Visual Studio Community if you're on Windows or VS Code if you're on Mac/Linux
2. Set up your development environment in Visual Studio or VS Code
3. Get started with videos or interactive tutorials
54 replies
✅ Implementing delete repository method & controller | Web Api
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, what you expect the result to be, what .NET version you are using and what platform/environment (if any) are relevant to your question. Upload code here https://paste.mod.gg/, save, and copy the link into chat for others to see your shared code! (see $code for more information on how to paste your code)
29 replies