开发者

Visual Studio: have region description be based on text within the region

开发者 https://www.devze.com 2023-02-06 22:53 出处:网络
With a method like this: #region _DESCRIPTION_ [Author(\"A\")] [City(\"B\")] [Year(\"2009\")] #endregion void Method() { }

With a method like this:

#region _DESCRIPTION_
[Author("A")]
[City("B")]
[Year("2009")]
#endregion
void Method() { }

I'd like _DESCRIPTION_ to reflect the value of the Author method attribute.

Any ideas on how I could implement this? The reason is that I have many attributes, some are long, so 开发者_StackOverflowI contain them within a region. I'd like the region description to reflect the value of one attribute in particular, automatically (otherwise I need to remember to update both each time).

I'm using VS 2010. Thanks.


I don't think this is doable at language level. #region is a preprocessor directive in C#, and C# spec does not offer this.

VisualStudio 2010 already implemented a feature that when you mouse over a collapsed block, it will show the first several lines of that block. Otherwise the only way maybe just do this

#region [Author("A")]
0

精彩评论

暂无评论...
验证码 换一张
取 消