如何在视觉工作室中变灰或突出显示? [英] How can I gray out or highlight in visual studio?

查看:60
本文介绍了如何在视觉工作室中变灰或突出显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我在Visual Studio(C#)的解决方案中工作,它有很多不应该更改的代码。也就是说,只应改变一小部分代码文件。



向其他程序员展示这个的最佳方法是什么?我认为理想的解决方案是能够使用灰色突出显示放手代码,但我不认为这是可能的。也许最好的方法是使用区域?



如果这个问题有点不清楚:让我们说一个代码文件有十个变量声明和十三种方法。我不希望其他程序员对七个变量和九个方法进行更改。我如何以简单明了的方式表明这一点?



此外,解决方案中的一些文件甚至三个项目中的两个应该保持不变。有没有办法显示这个(或者可能锁定它们)?



感谢您的任何建议!



Petter



我尝试了什么:



我试过寻找一种好方法,但不知道该找什么。很难搜索到这一点,因为代码和突出显示给了我错误的结果。

Hi,

I am working in a solution in Visual Studio (C#) that has a lot of code that shouldn't be changed. That is, only a small portion of the code files should be altered.

What would be the best way to show this to other programmers? I'm thinking that the ideal solution would be to be able to "highlight" the hands-off code using a gray color, but I don't think that's possible. Perhaps the best way is to use regions?

In case this question was a bit unclear: Let's say a code file has ten variables declared and thirteen methods. I don't want the other programmers to make changes to seven of the variables and to nine of the methods. How do I signal this in an easy and clear way?

In addition, some files and even two of the three projects in the solution should stay intact. Is there a way to show this (or perhaps to lock them)?

Thanks for any suggestions!

Petter

What I have tried:

I have tried to search for a good way of doing this, but don't really know what to look for. It's hard to search for this, as "code" and "highlight" gives me the wrong results.

推荐答案

大图:你所谈论的内容通常得到解决(由编程团队使用版本控制软件。



考虑将您不希望修改的代码部分放在单独的程序集中。在这些程序集中定义类,通过公共或受保护的访问修饰符公开某些成员。可能使这些课程成为单身人士(?)。



当然你可以使用部分课程来分割代码;也可以进入文件系统,选择包含部分Class的.cs文件并将其设置为只读。注意:我没有尝试过这个。
Big picture: what you are talking about is usually resolved (by a programming team) by using version control software.

Consider putting the parts of the code you do not wish modified in separate assemblies. Define Classes in these assemblies that expose some members via 'Public or 'Protected access modifiers. Possibly make these classes "singletons" (?).

Of course you can use "partial classes" to split up the code; it's also possible to go into the file system, select the .cs file containing the partial Class and make it read-only. Note: I have not tried this.


我对上述解决方案感到满意(试图关闭问题)。
I'm satisfied with the solutions above (trying to close the question).


这篇关于如何在视觉工作室中变灰或突出显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆