You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.1 KiB
38 lines
1.1 KiB
3 years ago
|
using System;
|
||
|
|
||
|
namespace ProtoBuf
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// Used to define protocol-buffer specific behavior for
|
||
|
/// enumerated values.
|
||
|
/// </summary>
|
||
|
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
|
||
|
public sealed class ProtoEnumAttribute : Attribute
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// Gets or sets the specific value to use for this enum during serialization.
|
||
|
/// </summary>
|
||
|
public int Value
|
||
|
{
|
||
|
get { return enumValue; }
|
||
|
set { this.enumValue = value; hasValue = true; }
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Indicates whether this instance has a customised value mapping
|
||
|
/// </summary>
|
||
|
/// <returns>true if a specific value is set</returns>
|
||
|
public bool HasValue() { return hasValue; }
|
||
|
|
||
|
private bool hasValue;
|
||
|
private int enumValue;
|
||
|
|
||
|
/// <summary>
|
||
|
/// Gets or sets the defined name of the enum, as used in .proto
|
||
|
/// (this name is not used during serialization).
|
||
|
/// </summary>
|
||
|
public string Name { get { return name; } set { name = value; } }
|
||
|
private string name;
|
||
|
}
|
||
|
}
|