Rest.Net/Rest.Net/RouteName.cs

39 lines
1.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MontoyaTech.Rest.Net
{
/// <summary>
/// The outline of an attribute that allows you to rename an attribute in
/// the output code generation.
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class RouteName : Attribute
{
/// <summary>
/// The name of this Route.
/// </summary>
public string Name = null;
/// <summary>
/// Creates a new default RouteName.
/// </summary>
public RouteName() { }
/// <summary>
/// Creates a new RouteName with a given name.
/// </summary>
/// <param name="name"></param>
public RouteName(string name)
{
if (string.IsNullOrWhiteSpace(name))
throw new ArgumentException("Cannot be null or whitespace", nameof(name));
this.Name = name;
}
}
}