Use AttributeUsage
using System;
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct,Inherited = false)]
public class ClassVersionAttribute : System.Attribute {
public ClassVersionAttribute(string target) : this(target, target) {
}
public ClassVersionAttribute(string target,string current) {
m_TargetVersion = target;
m_CurrentVersion = current;
}
private bool m_UseCurrentVersion = false;
public bool UseCurrentVersion {
set {
if (m_TargetVersion != m_CurrentVersion) {
m_UseCurrentVersion = value;
}
}
get {
return m_UseCurrentVersion;
}
}
private string m_CurrentName;
public string CurrentName {
set {
m_CurrentName = value;
}
get {
return m_CurrentName;
}
}
private string m_TargetVersion;
public string TargetVersion {
get {
return m_TargetVersion;
}
}
private string m_CurrentVersion;
public string CurrentVersion {
get {
return m_CurrentVersion;
}
}
}
Related examples in the same category