I find myself using Resharper's "convert to auto property" refactoring a lot to remove pre C# 3.0 boilerplate code.
Is there a way I can apply this to all properties in a single class at once?
...
I want to be able to refactor 500 projects at the same time.
I have about 20 solutions and I don't have a master solution with everything because I haven't figured out a way to auto generate it.
Any suggestions?
Thanks
Edit
I've tried slnTools from codeplex to generate a solution and visual studio pretty much took down the entire ...
Consider:
if (something) {
// Code...
}
With CodeRush installed it recommended doing:
if (!something) {
return;
}
// Code...
Could someone explain how this is better? Surely there is no benefit what so ever.
...
I'm still very new to programming and I want to write the cleanest code possible.
This may sound like a silly question, but what order should I put my methods in? Functionally of course it doesn't matter, but layout it makes a huge difference. So say we have the following code in one class:
-(void)testCreateProjectWithStartDate {
[...
Let me preface this by saying I now realize how stupid I am and was. I have been developing for 1 year (to the day) and this was the first thing I wrote. I now have come back to it and I can't make heads or tails of it. It worked at one point on a very simple app but that was a while ago.
Specifically I am having problems with Local...
I have a trigger that will be dynamically created, as it will be attached to a view that is also dynamically generated. I don't want my stored procedure to have the entire trigger within it, so I would like to move most of it to a stored procedure, but I won't know the fields in the inserted and deleted tables.
The trigger is about 90 ...
This is the code in my reports controller, it just looks so bad, can anyone give me some suggestions on how to tidy it up?
# app\controller\reports_controller.rb
@report_lines = []
@sum_wp, @sum_projcted_wp, @sum_il, @sum_projcted_il, @sum_li,@sum_gross_profit ,@sum_opportunities = [0,0,0,0,0,0,0]
date = @start_date
num_of_...
Possible Duplicate:
Using Emacs to recursively find and replace in text files not already open
Duplicate: using-emacs-to-recursively-find-and-replace-in-text-files-not-already-open
I need to to regexp search and replace on a list of files.
Is there an emacs command (command combo) for that?
Or maybe you have a better way to...
Background
Below is a typical piece of Perl code (sample.pl for the sake of discussion) that grabs submitted form data using CGI, passes the form data to DBI which will then retrieve the required rows from MySQL and then hands the results over to Template Toolkit to render into a HTML document for display.
Code listing for sample.pl :
...
I use a modified form of TODO comment (SteveC_TODO) that allows me to group my own todos together in the task list.
Yesterday I thought it would be nice to modify the refactoring snippets to add a todo comment to the usual NotImplemented exception. I modified the Method Stub - Body snippet to this
$signature$
{
//SteveC_TODO: impleme...
Hello SOers,
imagine you have the following interfaces:
public interface IInterfaceA : IInterfaceX
{
//
// declarations
//
}
public interface IInterfaceB : IInterfaceX
{
//
// declarations
//
}
public interface IInterfaceC : IInterfaceX
{
//
// declarations
//
}
Now I want to replace the followin...
I am aware that views should not have code in them but in a project I am working on I have a lot of logic in the views.
My home page has
<% Html.RenderPartial("SearchResults"); %>
Now in the partial view I have an aweful lot of logic like this;
<div id="RestaurantsList">
<%if (Model.restaurantsList.Count() > 0)
{
foreach (var ...
I have some code that I'm trying to rewrite. The code is designed to be "generic", in that it can be used by many different callers that require different "work flows". It goes something like this:
string globalA;
int globalB;
bool globalC;
// Lots more globals in various shapes and forms
void TheOneAndOnlyMethod(XmlBasedConfig config)...
I have implemented a sorting algorithm for a custom string that represents either time or distance data for track & field events. Below is the format
'10:03.00 - Either ten minutes and three seconds or 10 feet, three inches
The result of the sort is that for field events, the longest throw or jump would be the first element while for ...
In my C# code, I have an if statement that started innocently enough:
if((something == -1) && (somethingelse == -1) && (etc == -1)) {
// ...
}
It's growing. I think there must be 20 clauses in it now.
How should I be handling this?
...
Suppose that I have the following HQL:
String hql = "select e.aField from MyEntity as e";
If I want to refactor and change the name of the MyEntity's member variable aField to something else, I also have to change all occurrences in the whole code in Strings. If I forget to change one hql string the code breaks.
How can I avoid this ...
I've inherited a really poorly designed PHP spaghetti code project. It's been gaining a good bit of traffic recently and is starting to have performance issues on top of the poor monolithic code base. Its maxing out performance on a chunky 16GB dedicated machine when it really shouldn't be.
I'm planning on doing some performance twe...
Do you do it when you’re in the code doing something else?
When your manager approves it? (Seems this never happens)
I guess some of this depends on the impact of the changes. If I change the code and it affects nothing outside of the class, to me that is low impact.
What does it become a design change? When it effect X object or X pr...
I'm working on a project where we are doing a lot of custom javascript and especially jquery, on an mvc style project.
The only problem is that I keep adding more and more global functions/variables and they are piling up. I've got a few files but I'm unsure how to split some of the stuff up into separate files.
I've thought about co...
My first thoughts are too many lines of code in a method. In most cases it's easy to break something apart into multiple methods at least.
I have many more, but that seems to be one of the simplest to avoid. It really bugs me to see a method with 1000 lines of code, this also seems to be a common problem. Anything where you need to scr...