aspnetcore-realworld-example-app
aspnetcore-realworld-example-app copied to clipboard
Class vs Namespace
Is there a reason that something like Create.cs has Create as a class instead of a namespace? I have also been frequently told that I should follow one class per file. Would it be better to have create be a folder with The command/validator/handler as classes inside of that folder?
I put tiny classes into one file because it's easier to see them. They're related commands and often dev with them together.
Usually, I do put classes in their own file but trying out something new.
I totally get why they are in one file. I was more wondering why you had Create as a class instead of a namespace in that file.
I guess you refer to this part:
namespace Conduit.Features.Articles
{
public class Create // Class
{
public class ArticleData // Inner class
Why internal classes?
See my previous answer. I was following a pattern for grouping small classes. May not be always the best decision.