When developers face StyleCop
by Florian

seen from United States

seen from United States
seen from China

seen from Italy
seen from Spain
seen from United States
seen from United States
seen from United States
seen from China
seen from China
seen from China

seen from Argentina

seen from Romania

seen from Germany

seen from United States
seen from United States
seen from United States
seen from United States
seen from Canada
seen from United States
When developers face StyleCop
by Florian
Fixed Should using statements be inside or outside the namespace? #dev #it #asnwer
Fixed Should using statements be inside or outside the namespace? #dev #it #asnwer
Should using statements be inside or outside the namespace?
I have been running StyleCop over some C# code and it keeps reporting that my using statements should be inside the namespace.
Is there a technical reason for putting the using statements inside instead of outside the namespace?
Answer: Should using statements be inside or outside the namespace?
Putting it inside the namespaces makes…
View On WordPress
How to: Should using statements be inside or outside the namespace?
How to: Should using statements be inside or outside the namespace?
Should using statements be inside or outside the namespace?
I have been running StyleCop over some C# code and it keeps reporting that my using statements should be inside the namespace.
Is there a technical reason for putting the using statements inside instead of outside the namespace?
Answer: Should using statements be inside or outside the namespace?
According the to StyleCop Documentation:
View On WordPress
Constructing disposable resources safely
Code analysis can be a pain for unnecessary reasons sometimes, specially CA2000, so trying to work around the case where the constructor can throw:
T SafeBuildDisposableResource<T>() where T : class, IDisposable, new() { T resource = null; try { resource = new T(); return resource; } catch { if (resource != null) { resource.Dispose(); } throw; } }
And a test:
DataTable GetDataTable() { var resource = SafeBuildDisposableResource<DataTable>(); // Add columns... // Add rows... return resource; }
Meh, but VS 2012 is happy now...
Hello World!
namespace HelloWorld { using System; internal class Program { internal static void Main() { Console.WriteLine("Hello World!"); } } }
Since StyleCop I started to preemptively move using statements into namespaces. It would still complain about lack of documentation in the code above though, it always manages to find something.