Methods Module
Functions and values
| Function or value |
Description
|
|
|
|
|
|
Evaluate simple math between two constants. 9 * 3 --> 27 "G" + "G" --> "GG"
|
|
|
|
|
|
|
|
|
|
Purpose of this is to replace non-used anonymous types: new AnonymousObject(Item1 = x, Item2 = "").Item1 --> x
|
|
The later of two equal comparisons in one And'/Or' chain goes. Behind a short-circuit link (AndAlso, OrElse, a conditional) the right side runs only once the left side is true (false for Or'), so a comparison the left chain already holds is true (false) there. The earlier one stays, so nothing that was guarded by it runs ahead of it. Behind And/Or the right side runs regardless, and taking a comparison out of it would unguard what followed it there, so only a right side that is the comparison itself goes.
|
|
|
|
The purpose of this is to optimize away already known constant=constant style expressions. 7 > 8 --> False "G" = "G" --> True
|
|
Additional arithmetic identity optimizations x - 0 -> x, x - x -> 0, x % 1 -> 0
|
|
Simplify conditional expressions x ? true : false -> x, x ? false : true -> !x, x ? y : y -> y
|
|
String concatenation with empty string optimization "" + x -> x, x + "" -> x Only when x cannot be null: null + "" is "" (String.Concat), while x alone stays null, so `(x + "").Length` would go from 0 to a NullReferenceException.
|
|
|
|
|
|
|
|
|
|
Balance tree that is too much weighted to other side. The real advantage is not-so-nested-stack
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Factorize complementary disjunctions: (X && P) || (!X && P) -> P This handles the pattern where all states of a variable are covered
|
|
|
|
|
|
|