Link Search Menu Expand Document

5.6 Implicit object creation

CRS automatically creates an anonymous type-aware object when a property or method access occurs to a primitive ( String , Number , Date , etc.).

Example

var a = "Sample" .Length;

In this example, we are referencing the .Length property for a primitive of the character type “Sample”, so the CRS interpreter automatically decomposes this expression as follows and executes it.

var temp = new String ("Sample");
var a = temp.Length;

The automatically generated object is automatically deleted when the reference is finished. Therefore, even if you make a method call that involves an update operation, you cannot get the changed result from the object.

However, it is possible to get the return value of the method call.

var a = "abcdefg". ToUpperCase ();