Base wrapper class for the pointers to .NET objects. Offers basic methods to interact with the .NET objects.
Active bindings
typeString representation of the type of the .NET object. Read-only
pointerThe external pointer to the .NET object. Read-only
Methods
NetObject$getMemberSignature()
Gets a string representation of the signature of a member (i.e. field, property, method). Mostly used to interactively search for what arguments to pass to a method.
Examples
testClassName <- "ClrFacade.Tests.RefClasses.LevelOneClass"
o <- .External("r_create_clr_object", testClassName, PACKAGE = getRSharpSetting("nativePkgName"))
x <- newObjectFromName(testClassName)
print(x)
#>
#> ── <NetObject> ──
#>
#> Type: ClrFacade.Tests.RefClasses.LevelOneClass
#>
#> ── Available Methods
#> • `AbstractMethod()`
#> • `AbstractMethod()`
#> • `Equals()`
#> • `get_SomeInt()`
#> • `GetHashCode()`
#> • `GetType()`
#> • `ToString()`
#> • `VirtualMethod()`
#>
#> ── Available Properties
#> • SomeInt
testClassName <- getRSharpSetting("testObjectTypeName")
testObj <- newObjectFromName(testClassName)
testObj$getFields()
#> [1] "FieldDoubleOne" "FieldDoubleTwo" "FieldIntegerOne" "FieldIntegerTwo"
#> [5] "PublicInt"
testObj$getFields("ieldInt")
#> [1] "FieldIntegerOne" "FieldIntegerTwo"
testClassName <- getRSharpSetting("testObjectTypeName")
testObj <- newObjectFromName(testClassName)
testObj$getStaticFields()
#> [1] "StaticFieldIntegerOne" "StaticFieldIntegerTwo" "StaticPublicInt"
testObj$getStaticFields("ieldInt")
#> [1] "StaticFieldIntegerOne" "StaticFieldIntegerTwo"
testClassName <- getRSharpSetting("testObjectTypeName")
testObj <- newObjectFromName(testClassName)
testObj$getProperties()
#> [1] "PropertyIntegerOne" "PropertyIntegerTwo"
testObj$getProperties("One")
#> [1] "PropertyIntegerOne"
testClassName <- getRSharpSetting("testObjectTypeName")
testObj <- newObjectFromName(testClassName)
testObj$getStaticProperties()
#> [1] "StaticPropertyIntegerOne" "StaticPropertyIntegerTwo"
testObj$getStaticProperties("One")
#> [1] "StaticPropertyIntegerOne"
testClassName <- getRSharpSetting("testObjectTypeName")
testObj <- newObjectFromName(testClassName)
testObj$getMethods()
#> [1] "Equals" "get_PropertyIntegerOne"
#> [3] "get_PropertyIntegerTwo" "GetFieldIntegerOne"
#> [5] "GetFieldIntegerTwo" "GetHashCode"
#> [7] "GetMethodWithParameters" "GetPublicInt"
#> [9] "GetType" "set_PropertyIntegerOne"
#> [11] "set_PropertyIntegerTwo" "TestDefaultValues"
#> [13] "TestParams" "ToString"
testObj$getMethods("Get")
#> [1] "GetFieldIntegerOne" "GetFieldIntegerTwo"
#> [3] "GetHashCode" "GetMethodWithParameters"
#> [5] "GetPublicInt" "GetType"
testClassName <- getRSharpSetting("testObjectTypeName")
testObj <- newObjectFromName(testClassName)
testObj$getStaticMethods()
#> [1] "get_StaticPropertyIntegerOne" "get_StaticPropertyIntegerTwo"
#> [3] "set_StaticPropertyIntegerOne" "set_StaticPropertyIntegerTwo"
#> [5] "StaticGetFieldIntegerOne" "StaticGetFieldIntegerTwo"
#> [7] "StaticGetMethodWithParameters" "StaticGetPublicInt"
testObj$getStaticMethods("Get")
#> [1] "StaticGetFieldIntegerOne" "StaticGetFieldIntegerTwo"
#> [3] "StaticGetMethodWithParameters" "StaticGetPublicInt"
testClassName <- getRSharpSetting("testObjectTypeName")
testObj <- newObjectFromName(testClassName)
testObj$getMemberSignature("set_PropertyIntegerOne")
#> [1] "Method: Void set_PropertyIntegerOne, Int32"
testObj$getMemberSignature("FieldIntegerOne")
#> [1] "Field FieldIntegerOne, Int32"
testObj$getMemberSignature("PropertyIntegerTwo")
#> [1] "Property PropertyIntegerTwo, Int32, can write: True"
testClassName <- getRSharpSetting("testObjectTypeName")
testObj <- newObjectFromName(testClassName)
testObj$call("GetFieldIntegerOne")
#> [1] 0
testClassName <- getRSharpSetting("testObjectTypeName")
testObj <- newObjectFromName(testClassName)
testObj$get("FieldIntegerOne")
#> [1] 0
testClassName <- getRSharpSetting("testObjectTypeName")
testObj <- newObjectFromName(testClassName)
testObj$set("FieldIntegerOne", as.integer(42))