C# hide and unhide comments - c#

I am trying to find solution how to hide and unhide comments in VS2010. What i found is:
# region
comments for code
#endregion
and:
http://holyhoehle.wordpress.com/2010/01/17/hide-comments-in-visual-studio/
but this one is not working in VS2010 or i don't know how to...
So maybe any one can help and offer some solution how to hide comments like:
string x = "...." //comment

this extension is no longer maintained
I made a Visual Studio extension that allows you to hide/show comments.
You can get it here:
for Visual Studio 2010-2013
for Visual Studio 2015-2017

You can highlight them one by one, Right-click, and choose Outlining > Hide Selection.
The keyboard shortcut for that maneuver is Ctrl+M, Ctrl+H.

Aside from setting the font color of the comments to the same as the background color (which is what that VS plugin that you mentioned does), there is no way to hide comments.
Multi line comments (prefixed with either // or /* */ are already collapsible, but single line comments are not natively. Your only option for those is to use the Ctrl-MH key chord for a temporary (while the file is open) collapse (as mentioned in #rfmodulator's answer), or remove them altogether.
*The default C# key chord for collapsing all collapsible blocks is Ctrl-MO

You could use this macro to collapse all of the XML comments. I suspect that's about as good as you're going to get.
There is no way other than changing the comment color to hide inline comments and I could see that leading to all sorts of problems.

To hide the selected code or area (first select the area), just use Ctrl + M, Ctrl + H.
This works for any selection.

Using shortcut keys: Simply select your comment or working code and the just press:
Ctrl+M, Ctrl+H -> To hide (this simply collapse your selected section and make small box preview)
Ctrl+M, Ctrl+U -> To uhide

Related

Visual Studio 2019 Intellisense replace

I can't understand why intellisense does't want to replace line after dot with suggestion.
I pressed Ctrl + Space, selected suggestion and I expected the eoID to be replaced by fuID. But I got item.fuIDeoID = updItem.eoID;. To complete suggestion I tried to press Enter then Tab and result was same. Can someone explain how to get item.fuID = updItem.eoID; after complete selecting suggestion?
You need to highlight the part you want replaced. Currently your cursor is in insert mode (so to speak). You need to highlight the part you want replaced, bring up intellisense, and select the replacement value.
To replace press SHIFT+TAB or SHIFT+ENTER

Adding control event methods from the code window Drop downs always go to bottom, can this be changed

In the Visual studio IDE, i like to make regions to group functionality.
when I go to add a new code sub for a control event, by using the drop downs at the top of the code window and pick a control event that has not already been added.
it adds it to the bottom of the code window and I have to copy and paste it to move it back where I want it (at my current caret position).
Is there any way to make these generated control event methods insert at the current caret position instead of the bottom?
To clarify an example would be in the middle drop down box select Button1 in the right drop down box select the Click event.
if this is not a setting does anyone know of an addin that will accomplish this.
I couldn't seem to find a setting for this in the visual studio options (there may be one, but where)
Good question!
This is very annoying behaviour. Would be good to find an option for this, or get it sorted by Microsoft.

When the user clicks on an UltraGrid cell that contains multiple lines of text, the selected text loses the CRLFs

I have a C# program that uses an Infragistics UltraWinGrid to display comments. A comment can be multiple lines. That is, it can contain carriage return/line feeds (CRLFs). (See the upper portion of the attached screenshot.) But when the user selects the text of the comment by clicking on the cell, it loses the CRLFs. (See lower portion.) This is a problem, because comments can be very long and the user may want to copy and paste a comment somewhere else without losing the formatting.
From what I understand, this problem results because the grid uses a Windows textbox as an editor when the user clicks on a cell. Is there some way that I can either make the textbox keep the CLRFs or replace the textbox with an editor that does? Thanks.
Turns out there are a few stars that need to align for this.
Of course CellMultiLine needs to be set for the column like wnvko pointed out.
But also, you must make sure your Column Style is NOT FormattedText or FormattedTextEdit. (If that's required for editing i think you are out of luck). Just use Default style.
And finally make sure you CRLFs are actually truly CRLFs. My best suggestion is to use Environment.NewLine. If you are pulling the data from the DB, make sure you use CHAR(13) + CHAR(10) in that specific order. See Differences Between vbLf, vbCrLf & vbCr Constants
Hope this helps 4 years later. :-) But wanted to share for others since i found no solution elsewhere.
My suggestion is to use Templates. Have a look at the official Infragistics UltraWebGrid help book that is explaining in depth how to configure features like Row and Column Templates.
Go to page 74 for more information regarding the templating.
You should set CellMultiLine of the column to True. Here is how it is working when I set it in my grid
I never found a real answer to this question, but I was able to do a workaround by capturing the click event and having it open a small dialog box containing the cell text. I had the dialog box open at the point the user clicked, so that it appeared over the cell. After a few minor adjustments to take care of border conditions, it worked surprisingly well, so I'm calling this one solved. Thanks, everyone, for your suggestions.

Resharper generate auto-properties for code

I have a situation like that :
is there any way to generate all of those properties at once rather then clicking on each one ?
Whilst strictly an answer to what you asked, as R# can't do what you want, I find NimbleText (http://nimbletext.com/) to be extremely useful for this sort of thing.
You paste your C# into the top panel, add a template to the second panel, using things like $1, $2, etc for the data fields, and the resultant text appears in the third panel.
One of the most useful tools I've ever found, and free too!

Auto complete property in asp.net c#

I have noticed many times developers use like a quick key to generate properties but I can not find what that key is. Is there a list i can look at with all the short keys?. what i am referring to is like when you do
Highlight method + F12 takes you to the reference (for example), there is one specifically that would help me a lot, the property auto complete it usually puts something like
public int something, and the color shows as green or something. Any help would be much appreciated.
This is done with snippets. The default snippet can be expanded by typing prop and then pressing TAB.
I think what you're seeing is CodeRush. If this visual is the green you're referring to, it's CodeRush:
also, if intelisence is ever "not there", simply press control + space. Works in Netbeans and Visual Studio

Categories

Resources