Hello.
I was wondering if there is some option to keep ReSharper from removing just the using System; directive? Perhaps this is configurable somewhere?
Also, is there a way to have ReSharper sort the remaining directives just as Visual Studio 2008 does it (alphabetically, I think)?
Thanks.
...
I've been using ReSharper for the past months and, advertising aside, I can't see myself coding without it. Since I love living on the bleeding "What the hell just went wrong" edge, I decided to try my luck w/ the latest ReSharper 4.5 nightly builds. It's all nice.
However, I've noticed that the using directives grouping format has chan...
Why does Visual Studio 2008 automatically insert the following using directives into each new C# file I create?
using System;
using System.Collections.Generic;
using System.Text;
What's so special about these namespaces? Are these the most frequently used ones?
...
After someone creates a DLL in C# using the Microsoft Visual development environment, how would another programmer take that code, make a new project that includes the DLL's source and make a GUI that uses the DLL'S API?
I have already done the following four steps:
1) In the Solution Explorer right-click "References" and select "Add R...
Hi,
I like to put my using directives inside the current namespace, and not outside as VS and Resharper per default puts them.
Does anyone know of a macro/standard functionality that sorts/removes unused using directives and puts them inside the current namespace?
--larsw
...
I saw this C# using statement in a code example:
using StringFormat=System.Drawing.StringFormat;
What's that all about?
...
In VB.Net you can do something like the following without any issues... just ignore the fact that this is a pretty useless class :-)
Imports System
Public Class Class1
Public Shared Function ArrayToList(ByVal _array() As String) As Collections.Generic.List(Of String)
Return New Collections.Generic.List(Of String)(_array)
...
In C#, how many classes can you inherit from?
When you write:
using System.Web.UI;
is that considered inheriting from a class?
...
When I use ReSharper to add a using directive (using Alt+Enter) it removes "unnecessary" parts of the namespace. I prefer using the full namespace which is also the behavior of Visual Studio.
Example:
namespace MyCompany.MyTool.Data
{
// This is what ReSharper gives me:
using Core;
// This is what I want:
using MyComp...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
I have to put the above code in almost every .cs file. Is there any way to avoid it?
...
Right, I've usually used 'using' directives as follows
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AwesomeLib
{
//awesome award winning class declarations making use of Linq
}
i've recently seen examples of such as
using System;
using System.Collections.Generic;
using System.Lin...
I'm in the process of writing a small asp.net mvc application that is using the northwind.mdf. When building the solution I get this error:
Error 1 The type or namespace name 'Order' could not be found (are you missing a using directive or an assembly reference?)
Order is a table in the northwind database.
any help is most appreciate...
Two-phase lookup question:
Is there a more synthetic way to write this code, i.e. avoiding all those using directives?
Something like using CBase<T>; is what I would like, but it is not accepted.
#include <iostream>
template <typename T>
class CBase
{
protected:
int a, b, c, d; // many more...
public:
CBase() {
a = 1...
Sorry for this silly question, but is there any way to restrict using directives to the current file so that they don't propagate to the files that #include this file?
...
I get the following error when I try to compile my C# program:
The type or namespace name 'Login' could not be found (are you missing a using directive or an assembly reference?)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;...
Before making a commit, I prefer to run all hundred-something unit tests in my C# Solution, since they only take a couple minutes to run. However, if I've already run them all, all is well, and then I decide to organize the using directives in my Solution, is it really necessary to re-run the unit tests? I have a macro that goes throug...
What purpose does “using” serve when used the following way:-
ONE EXAMPLE IS THIS, (AN ANSWERER- @richj - USED THIS CODE TO SOLVE A PROBLEM THANKS)
private Method(SqlConnection connection)
{
using (SqlTransaction transaction = connection.BeginTransaction())
{
try
{
// Use the connection here
...
I frequently use the "Remove and sort usings" feature of VS/PowerCommands - in fact, with the help of R#, I make VS do this for me every time i save the document, which I almost reflexively do almost every time I finish writing a code line without errors.
However, there are a couple of namespaces that, if they are there, I don't want to...
I have seen that you can either do
using System.IO
and use
Path.GetDirectoryName(blah blah)
OR directly use
System.IO.Path.GetDirectoryName(blah blah);
Is there any difference between them from a point of performance?
Does using System.IO loads all static classes in the namespace to the memory resulting in using more memory...
I am using the debugger to step through my code. The code file I’m in has usings at the top, including for example
using System.Linq;
In Visual Studio 2008 this used to apply to the Watch window while debugging, so I could use extension methods such as .First() and .ToArray() in the watch window.
For some reason, this has stopped wor...