2
我有一个自定义属性...IDE强调自定义属性
[System.AttributeUsage(System.AttributeTargets.All)]
public class Refactor : System.Attribute
{
private string _message;
public Refactor()
{
_message = string.Empty;
}
public Refactor(string message)
{
_message = message;
}
}
适用于
[Refactor("this should be less rubbish")]
public virtual void RubbishMethod()
{
…
}
现在,当有人拨打电话时RubbishMethod
我想的IDE(VS2008)强调那叫一个深棕色,类似于如果我标记为Obsolete,你会得到一条绿色的波浪线。这可能吗?我一直在绞尽脑汁,打谷歌,但我无法找到如何以及在哪里做到这一点。
重复:http://stackoverflow.com/questions/154109/custom-compiler-warnings(简短的回答:没有,'Obsolete'是魔法) – AakashM 2010-04-08 10:59:39
ps的属性名应当在'Attribute' :) – AakashM 2010-04-08 11:00:05
@AakashM结束 - 谢谢。 – gingerbreadboy 2010-04-08 11:09:13