Sep
08
2009

Thanks to DevExpress CodeRush CodeIssues it has taught me a simplified initiation of object

User Rating: / 0
PoorBest 

I am a VB.NET programmer, don’t hold it against me :) I have learnt alot of C# by having to modify OpenSource projects that use C# and personally I can’t see much difference other than what your use to “Reading” syntax wise. I haven’t come across anything that C# can do that VB.NET can’t and that has mostly to do with the MSIL (the language that both C# and VB.NET get compiled into).

The thing I like about CodeRush is it is completely Language independant, if you perform a Property Temple like “pi” it will generate a VB.NET Property as Integer in a VB project or a C# Property as Int in a C# project. Recently with DevExpress releasing v9.2 of their products they had a major performance improvement in their CodeRush add-in for Visual Studio. I heavily use RefactorPro! and CodeRush and when Mark announce CodeIssues a while back I tried to use it however it seemed a little unstable back then. A completely different story with v9.2.

CodeIssues scans your code and provides you with Suggestions to “improve” your code, these suggestions can be major like missing conditions, to just cleaning up code such as the “Rename File to match Class”. During using this I keep finding new ways to represent code and one thing I found interesting recently was this snippet

            Dim newObj As New Diag
            newObj.State = Diag.DiagState.Passed

This is quite a normal approach, define a variable and assign it a new instance of a class then the next line assign something to a property, however CodeRush CodeIssue had a suggestion, so I decided to try it

            Dim newObj As New Diag With {.State = Diag.DiagState.Passed}

Personally I prefer this line as it keeps the code clean and makes the line more defining, we see we define a variable then create a new instance of a Diag Class and assign the property State to Passed, and all in one line.

To anyone who hasn’t tried CodeRush/RefactorPro! I would suggest you head over to http://www.devexpress.com and download their “FREE” CodeRush/Refactor Xpress. When I say free, I actually mean it is Free, no strings attached. The Xpress version hasn’t got all the bell’s and whistles of the full product but then again if you aren’t using DevExpress components in your project maybe you should take a look at them as well as I couldn’t live without them.

So I say thanks to DevExpress for helping a developer learn new ways of using the .NET language.

EDIT: A good quick case study on performance gains with CodeRush/Refactor!Pro http://www.devexpress.com/Home/DeveloperStories/McGregorBfa/

Comments  

 
0 # Jim Clay 2009-12-23 04:49
I noticed this also and have started using it unless I have a lot of properties to define. Then I prefer the old way lined up nicely.
-Jim
Reply | Reply with quote | Quote
 

Add comment

Although I believe your free to say what you want, please don't abuse either myself or other peoples, be constructive.


Security code
Refresh

Should AussieALF stay bald?




Results

Latest Comments

My Twitter

Follow me on twitter