VS 2017: How can I change the "Convert to full property" template? - c#

How can I change the "Convert to full property" template to not prefix private fields with underscore?
Right now it does this...
...But I don't want to have underscore prefixes on my fields.
I also don't want them to be in a single line if it's a full property.
Thanks in advance :)

You can change that in the options of Visual Studio.
In the options (menu Tools > Options...) navigate to
Text Editor > C# > Code Style > Naming
Click the button Manage styles and define your own style (e.g. "camelCase").
Under "Private or Internal Field" choose your desired style.
The templates will use these style settings.
Btw.: the underscore is there to differentiate the fields from the local variables and method parameters. In VB the prefix "m_" is often used for fields. "m" stands for "member", (e.g. m_myField).

Related

Prevent Visual Studio from highlighting similar words

If I highlight a variable named "abc", and I also have a method named "abc1", the abc in abc1 get lightly-highlighted.
I tried preventing that by unchecking Tools > Options > Text Editor > C# > Advanced > Highlighting > Highlight related keywords under cursor [what does that even mean?] but to no avail.
Is there a way to prevent that?
(VS version 17.4.2)
This is the Selection Match Highlighting feature.
The selection match highlighting is a new feature to help you quickly
find additional occurrences of a string in the document you’re
editing.
When it’s checked, any time you select something in your editor, anywhere else that exact string occurs will be subtly highlighted both in the editor and in the scrollbar.
To disable, uncheck the "Show selection matches" checkbox
Tools > Options > Text Editor > General > Show selection matches

How to enable widget properties in GTKSharp (MonoDevelop)

Good day! I just want to ask if how could I enable widget properties in GTKSharp. It was already there before the first time I installed MonoDevelop. But now I can't find it . I already tried to enable it via View > Pads > Properties but it is different. It is in general properties, not the specific widget properties like in this example. When I clicked the button to edit its properties, I can't (e.g. editing the name value of the button, resizing, etc. via widget properties) like I did before.
How could I enable it? Thanks!
View > Pads > Properties is correct.
That pad is context sensitive, so you have to be in the Designer mode (stetic). Select any widget and the Properties Pad will show you the widget's Properties and Signals.

How to set the color for the placeholders in a format string

I have Resharper installed in Visual Studio, and am using the standard 'dark' theme, and somehow I managed to change something so that the '{0}' characters in a format string are no longer colored differently than the rest of the string.
For example, in the following line:
Console.WriteLine("Hello {0}", Environment.UserName);
The quoted string is entirely the same rust color (as it appears in this SO editor), whereas previously the '{0}' was highlighted with a bright greenish color.
EDIT
The settings under 'Resharper Format String Item' appear correct:
Also, the R# Code Annotations is set to JetBrains.Annotations, and is set as the default:
Would some other setting override this? Is there an easy way to just reset everything back to defaults?
I've found the element in the change font dialog. It was a nightmare, hope it helps.
As you've already noted, Resharper knows what color to use for this according to the setting here:
Options > Environment > General > Fonts and Colors — the Resharper Format String Item setting.
However, R# knows which methods to apply that color to by using its internal Code Annotations feature.
Check under Resharper > Options > Code Inspection > Code Annotations , and make sure that JetBrains.Annotations is checked, and that it is selected as the default annotation namespace at the bottom of that screen.

Microsoft ReportViewer(windows) and CSS Property

I'm using Microsoft Report Viewer in windows application and its datasource
is a custom class object. I have several Text fields and some are in different formats
(ie size of the font, underline, bold....) but several are grouped.
For these reason I would like to use a CSS (Cascading Style Sheet) class or some thing similar for formatting. (now I formatting each controls manually).
Is there a way to do this?
No, there is no way to do this. RDL, and all of the tools built around it (like ReportBuilder, BIDS, etc) have no concept of stylesheets of any kind.
The best solution is to select all the textboxes at once that you want all to be the same, then edit their properties in the property grid (in BIDS, Visual Studio or ReportBuilder). If you instead edit their properties through the property dialog, you must do it one at a time.
Probably the best you can do is to use expression parameters when you set the Font.
e.g. define report pararameter #FontSize and set default to 10
This allows you to override your default font size when you request the report by setting the report parameter.
I don't believe you can use CSS for a desktop windows application, your best bet is to look at the custom formatting for each cell of the ReportViewer

Make Properties/Functions Bold in Intellisense

Is there any way to Highlight Properties/Functions on your custom classes in intellisense? It's used lots in the Framework and it really helps show main features of a class. I've tried looking for an attribute because I know the obsolete attribute influences the display, but no luck.
EDIT
The original question is flawed because of my misunderstanding of how intellisense displays items. As explained in answers the bold items are new properties/functions created by a child class, in other words the Bold is done automatically.
I am still interested if there is any other way to highlight certain functions, I am using ReSharper if that helps.
The bold entries in IntelliSense are the members directly implemented on the class, with the inherited properties and methods shown in a regular font.
If it helps, you can hide 'advanced' entries from the list using the [EditorBrowsable] attribute. In this context, 'advanced' means 'hidden when the Hide Advanced Members setting is enabled via Tools | Options | Text Editor | C#'.

Categories

Resources