The Convert to Size refactoring from DevExpress Refactor! Pro consolidates selected numeric parameters into a System.Drawing.Size (System.Windows.Size in WPF projects) or SizeF object. It might be useful to combine two parameters into a single parameter, reducing the overall number of method parameters and increasing code readability.
Read more…
In C#, C++ and JavaScript languages, curly braces are used as block delimiters. A block allows multiple statements to be written inside. If a block contains a single statement, block delimiters, in most cases, are optional. For example, a single statement inside a loop does not require block delimiters:
Read more…
There are a couple of visibility-changing refactorings shipped in DevExpress Refactor! Pro.
This refactoring allows you to quickly reduce the visibility of a member to match the highest calling visibility, in other words, to restrict the visibility as much as possible.
Each member of a type declaration has an associated visibility (accessibility) modifier, which controls the access to this member for other members. The Reduce Visibility refactoring shipped in Refactor! Pro allows you to quickly reduce the visibility of a member to match the highest calling visibility, in other words, to restrict the visibility as much as possible.
Read more…
The scope of a variable declaration determines its visibility to the rest of a program. Scopes can be member-level, class-level and nested, where an inner scope may re-declare the meaning of a variable from an outer scope.
When declared inside a member, the scope of the variable is the entire member after the variable declaration, including all nested code blocks. This means that the variable is available to use within the member but when control passes to another member, the variable is unavailable.
Read more…
The With statement (in Visual Basic) is used to execute a series of statements of the particular object without requalifying the name of the object. In other words, we can use the With statement to reduce the number of times we needed to manually type the full path to the target object. For example, this function inverts the background color of the active control of the active form in the current Windows application:
Read more…
The String data type of .NET Framework is one of the most often used types when developing software. There are a number of basic operators available for use with strings, such as concatenation and equality comparison. Also the data type is based on a class that includes many powerful methods for string manipulation. Let’s take a brief look at what refactorings shipped in DevExpress Refactor! Pro help us deal with the String data type. You can follow each link, to learn more about a specific refactoring.
The Use String.Compare refactoring shipped in DevExpress Refactor! Pro allows you to convert a usual string equality comparison (==) into a more flexible Compare call on the System.String class. Consider the following code:
Read more…