Skip to content

Assign value to a string based on the string variable's name. A quicker alternative to using nameof directive.

Notifications You must be signed in to change notification settings

clearwaterstream/Inferred

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Inferred

Assign value to a string based on the string variable's name.

Examples

Instead of doing this

public class OrderStatus
{
  public static readonly string Created = nameof(Created);
  public static readonly string SentToFulfillmentCentre = nameof(SentToFulfillmentCentre);
  public static readonly string Shipped = nameof(Shipped);
}

You can do this

public class OrderStatus
{
  public static readonly string Created = new Inferred();
  public static readonly string SentToFulfillmentCentre = new Inferred();
  public static readonly string Shipped = new Inferred();
}

About

Assign value to a string based on the string variable's name. A quicker alternative to using nameof directive.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages