Creating Your Own Custom Attributes in C# and Retrieving Their Values

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • InfluxDB - Access the most powerful time series database as a service
  • SonarQube - Static code analysis for 29 languages.
  • SaaSHub - Software Alternatives and Reviews
  • custom-attributes

    A demo of how to use custom attributes in C# and .NET Core

    GitHub repository for the code used in this article

  • xUnit

    xUnit.net is a free, open source, community-focused unit testing tool for .NET.

    I was trying to think of an example of where C# attributes might be used in every day life and then it dawned on me: unit testing! If you have ever used a unit test framework such as MSTest, NUnit or xUnit, you will have used attributes in C# to define the classes and methods that you would like the test framework to execute. This is just one example of how you can use attributes to assign metadata to elements of your code.

  • InfluxDB

    Access the most powerful time series database as a service. Ingest, store, & analyze all types of time series data in a fully-managed, purpose-built database. Keep data forever with low-cost storage and superior data compression.

  • NUnit

    NUnit 3 Framework

    I was trying to think of an example of where C# attributes might be used in every day life and then it dawned on me: unit testing! If you have ever used a unit test framework such as MSTest, NUnit or xUnit, you will have used attributes in C# to define the classes and methods that you would like the test framework to execute. This is just one example of how you can use attributes to assign metadata to elements of your code.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts