Skip to content
No description, website, or topics provided.
C#
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Images
ProductivityTools.DescriptionValue.Tests
ProductivityTools.DescriptionValue
.gitignore
.powershell
ProductivityTools.DescriptionValue.sln
README.md

README.md

Description attribute value

Library allows to get description content from DescriptionAttribute.

Currently it retrieve value from following elements:

  • Property

  • Field

  • Method

  • Enum

Usage example:

typeof(TestClass).GetPropertyDescription("PropertyName"); 
typeof(TestClass).GetFieldDescription("FieldName"); 
typeof(TestClass).GetMethodDescription("Method1"); 
testClass.Enum.GetDescription();

all methods:

  • extension method Description for enum
  • extension method Description for Type
  • extension method PropertyDescription for Property
  • extension method MethodDescription for Method
  • extension method FieldDescription for Field

Description is not existing

Method will throw an exception if we will try to get value from item which doesn't have exception set up. You could use DescriptionExists* methods to validate before using. Methods:

  • extension method DescriptionExists for enum
  • extension method DescriptionExists for Type
  • extension method PropertyDescriptionExists for Property
  • extension method MethodDescriptionExists for Method
  • extension method FieldDescriptionExists for Field
You can’t perform that action at this time.