Advertisement
ivandrofly

Common folder in Project structure

Aug 3rd, 2023 (edited)
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. The "Common" directory in a .NET project typically contains classes, utilities, and components that are shared across different parts of the application or even across different projects within the same solution.
  2.  
  3. Generally, you might place the following types of classes in a "Common" folder:
  4. Utility or Helper Classes: These are classes that provide common functionality that's used in various places in the application, such as string manipulation, date/time format conversion, error logging, validation, etc.
  5.  
  6. Constants: You might have a class that just contains constant values that are used throughout your application.
  7. Extensions: You may write extension methods for existing .NET classes or your own custom classes. These are typically placed in a common location as they are often used across the project.
  8. Shared Interfaces or Base Classes: If you have interfaces or base classes that multiple components depend upon, those could go in the common folder.
  9.  
  10. Shared Model Classes: For example, DTOs (Data Transfer Objects) or entities that are used in multiple parts of the application.
  11. Cross-Cutting Concerns: Like logging, caching, configuration, and exception handling.
  12. Remember, organizing your code into appropriate folders is a matter of keeping your project structured, maintainable and ensuring that components can easily be found when needed. The "Common" directory approach is a popular one, but it's not strict, and depending on the project structure and team preferences, it might be called differently, like "Shared", "Utilities", etc.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement