473,473 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

closing } automatically

Does anyone know a way to make the IDE close braces in Ifs statements
(methods also) for C# ?
In VB.NET you have an automatic closing...
Aug 10 '06 #1
3 1409
If your using VS.NET 2005 you can just type the word "if" and then hit tab. "if" is a built-in code snippet. You can write your
own code snippets if you'd like and place them in your "My Documents/Visual Studio 2005/Code Snippets" folder. VS.NET picks them up
without even having to restart the IDE.

If your using an older version I think you might be out of luck. Maybe you could write an addin and assign it to a specific
keyboard shortcut, but I'm not sure how difficult that would be.

--
Dave Sexton

"Bruce One" <ra**@virtualsoftware.com.brwrote in message news:50**********************************@microsof t.com...
Does anyone know a way to make the IDE close braces in Ifs statements
(methods also) for C# ?
In VB.NET you have an automatic closing...

Aug 11 '06 #2
Thats true, this snippet code may help in If statements...
But what about when we write a new method ? Then we have to write the 2
parenthesis and after the 2 braces...its not possible to let IDE fill it for
us, like in VB.NET right?

"Dave Sexton" wrote:
If your using VS.NET 2005 you can just type the word "if" and then hit tab. "if" is a built-in code snippet. You can write your
own code snippets if you'd like and place them in your "My Documents/Visual Studio 2005/Code Snippets" folder. VS.NET picks them up
without even having to restart the IDE.

If your using an older version I think you might be out of luck. Maybe you could write an addin and assign it to a specific
keyboard shortcut, but I'm not sure how difficult that would be.

--
Dave Sexton

"Bruce One" <ra**@virtualsoftware.com.brwrote in message news:50**********************************@microsof t.com...
Does anyone know a way to make the IDE close braces in Ifs statements
(methods also) for C# ?
In VB.NET you have an automatic closing...


Aug 11 '06 #3
Hi Bruce,

You can write your own snippets, as I suggested. VS.NET 2005 even gives you intellisense for the XML schema. It really is simple.

Here's a snippet that you can name, "method.snippet" and place in your My Documents/Visual Studio 2005/Code Snippets folder. Extend
it all you want.

For now it generates the following method stub:

public $return$ $name$()
{
$end$
}

[void] is an input parameter that VS.NET 2005 treats as an input box. Tab through each input box and enter the appropriate data,
with the exception of [end]. Press the 'Enter' key when you are finished filling in the variables. [end] is where the cursor is
placed after you hit 'Enter'.

<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Public Parameterless Method</Title>
<Shortcut>method</Shortcut>
<Description>Stubs out a simple, public method without any parameters.</Description>
<Author>Copyright (c) 2006 Dave Sexton</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
<SnippetType>SurroundsWith</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal Editable="true">
<ID>return</ID>
<Default>void</Default>
</Literal>
<Literal Editable="true">
<ID>name</ID>
<Default>MethodName</Default>
</Literal>
</Declarations>
<Code Language="csharp">
<![CDATA[public $return$ $name$()
{
$end$
}]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>

--
Dave Sexton

"Bruce One" <ra**@virtualsoftware.com.brwrote in message news:54**********************************@microsof t.com...
Thats true, this snippet code may help in If statements...
But what about when we write a new method ? Then we have to write the 2
parenthesis and after the 2 braces...its not possible to let IDE fill it for
us, like in VB.NET right?

"Dave Sexton" wrote:
>If your using VS.NET 2005 you can just type the word "if" and then hit tab. "if" is a built-in code snippet. You can write your
own code snippets if you'd like and place them in your "My Documents/Visual Studio 2005/Code Snippets" folder. VS.NET picks them
up
without even having to restart the IDE.

If your using an older version I think you might be out of luck. Maybe you could write an addin and assign it to a specific
keyboard shortcut, but I'm not sure how difficult that would be.

--
Dave Sexton

"Bruce One" <ra**@virtualsoftware.com.brwrote in message news:50**********************************@microsof t.com...
Does anyone know a way to make the IDE close braces in Ifs statements
(methods also) for C# ?
In VB.NET you have an automatic closing...



Aug 11 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jean-Fran?ois Lacrampe | last post by:
Hello, I want to write a _very_ simple text parser that would replace a string like: "This is text with /italics/, *bold* and _underline_." and generate automatically something like this: ...
4
by: James | last post by:
Quick question about closing recordsets and connection objects. We're in the process of rewriting a TON of bad code. None of it is even remotely tabbed properly, it's impossible to read half the...
2
by: Ron L | last post by:
I have an MDI application which opens a number of child windows, each of which could have data in a state that needs to be saved. Each child window catches its Closing event and cancels it if the...
102
by: Skybuck Flying | last post by:
Sometime ago on the comp.lang.c, I saw a teacher's post asking why C compilers produce so many error messages as soon as a closing bracket is missing. The response was simply because the compiler...
3
by: Zeng | last post by:
Is there any advantage of always calling SqlConnection's Close method after done using it vs. just let it go out of scope open and hope the garbage collection will take care of it? thanks!
7
by: Tumurbaatar S. | last post by:
Is it so important to close database connections? As I understand, after processing a request and sending a response, page object destroyed. So all used connections also destroyed. Yes?
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
5
by: Oenone | last post by:
I have a VB.NET form which I'm displaying modally using the ShowDialog() method. Within the form is a Cancel button, and I've set this button into the Form's CancelButton property so that...
14
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using VS2005 and .net 2.0. I'm creating an application that has 3 forms. I want allow users to move forward and backward with the forms and retain the data users have entered. I thought...
19
by: zacks | last post by:
I have a .NET 2.0 MDI application where the child form has a Tab Control. Each of the Tab in the Tab Control has a Validating event to handle what it should do when the user changes tabs. But...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.