| Title: | Accessing .NET from R |
|---|---|
| Description: | Enable low-level access to .NET runtime from R. Provides a set of functions to create and manipulate .NET objects, call methods, and access properties and fields. |
| Authors: | Open-Systems-Pharmacology Community [cph], esqLABS GmbH [fnd], Pavel Balazki [aut, cre], Juri Solodenko [aut] (ORCID: <https://orcid.org/0000-0001-6922-588X>), Michael Sevestre [aut], Robert McIntosh [aut], Felix Mil [aut], Jean-Michel Perraud [aut], Ian Peter Du [ctb] |
| Maintainer: | Pavel Balazki <[email protected]> |
| License: | file LICENSE |
| Version: | 1.2.2 |
| Built: | 2026-07-11 04:42:44 UTC |
| Source: | https://github.com/Open-Systems-Pharmacology/rSharp |
Gets the type name of an object, given the SEXP external pointer to this .NET object.
.clrTypeNameExtPtr(extPtr).clrTypeNameExtPtr(extPtr)
extPtr |
external pointer to a .NET object (not a 'cobjRef' S4 or a 'NetObject' object) |
a character string, the type name
## Not run: testClassName <- getRSharpSetting("testObjectTypeName") testObj <- newObjectFromName(testClassName) .clrTypeNameExtPtr(testObj$pointer) ## End(Not run)## Not run: testClassName <- getRSharpSetting("testObjectTypeName") testObj <- newObjectFromName(testClassName) .clrTypeNameExtPtr(testObj$pointer) ## End(Not run)
This function is highly unlikely to be of any use to an end user, even an advanced one. This is indirectly needed to unlock the benefits of using R.NET convert data structures between R and .NET.
.getCurrentConvertedObject().getCurrentConvertedObject()
a 'cobjRef' S4 object
Create if possible and adequate the S4 object that wraps the external pointer to a 'cobjRef' object.
.mkClrObjRef(obj, clrtype = NULL).mkClrObjRef(obj, clrtype = NULL)
obj |
the presumed external pointer. |
clrtype |
character; the name of the type for the object. If NULL, rSharp retrieves the type name. |
a cobjRef S4 object if the argument is indeed an external pointer, otherwise returned unchanged.
Call a static method on a .NET type
callStatic(typename, methodName, ...)callStatic(typename, methodName, ...)
typename |
type name, possibly namespace and assembly qualified type name, e.g. 'My.Namespace.MyClass,MyAssemblyName'. |
methodName |
the name of a static method of the type |
... |
additional method arguments passed to .External (e.g., arguments to the method) |
an object resulting from the call. May be a 'NetObject' object, or a native R object for common types. Can be NULL.
cTypename <- getRSharpSetting("testCasesTypeName") callStatic(cTypename, "IsTrue", TRUE)cTypename <- getRSharpSetting("testCasesTypeName") callStatic(cTypename, "IsTrue", TRUE)
Create if possible an object of the R6 class 'NetObject'
castToRObject(obj, recursive = TRUE)castToRObject(obj, recursive = TRUE)
obj |
the presumed external pointer. |
recursive |
logical; if TRUE, the function is applied recursively to the list elements. |
Create if possible and adequate the R6 object of the class 'NetObject' that wraps the external pointer to a .NET object. If 'obj' is not a pointer, returns 'obj' unchanged.
A 'NetObject' R6 object if the argument is indeed an external pointer, otherwise returned unchanged. If 'recursive' is TRUE and 'obj' is a list, the function is applied recursively to the list elements.
castToRObject(1) castToRObject("a") castToRObject(TRUE) castToRObject(FALSE) castToRObject(1L) castToRObject(1.1) castToRObject(1.1 + 1i) castToRObject(list(1, 2, 3)) castToRObject(data.frame(a = 1:3, b = c("a", "b", "c")))castToRObject(1) castToRObject("a") castToRObject(TRUE) castToRObject(FALSE) castToRObject(1L) castToRObject(1.1) castToRObject(1.1 + 1i) castToRObject(list(1, 2, 3)) castToRObject(data.frame(a = 1:3, b = c("a", "b", "c")))
List the public constructors of a CLR Type
getConstructors(type)getConstructors(type)
type |
.NET Type, or a (character) type name that can be successfully parsed |
a list of constructor signatures
testClassName <- "ClrFacade.TestObject" getConstructors(testClassName)testClassName <- "ClrFacade.TestObject" getConstructors(testClassName)
Gets the names of a .NET Enum value type
getEnumNames(enumType)getEnumNames(enumType)
enumType |
a .NET object, System.Type or type name, possibly namespace and assembly qualified type name, e.g. 'My.Namespace.MyClass,MyAssemblyName'. |
a character vector of the names for the enum
enumName <- "ClrFacade.TestEnum" getEnumNames(enumName) # Get enum names from object enumObj <- newObjectFromName(enumName) getEnumNames(enumObj)enumName <- "ClrFacade.TestEnum" getEnumNames(enumName) # Get enum names from object enumObj <- newObjectFromName(enumName) getEnumNames(enumObj)
List the names of loaded assemblies
getLoadedAssemblies(fullname = FALSE, filenames = FALSE)getLoadedAssemblies(fullname = FALSE, filenames = FALSE)
fullname |
should the full name of the assemblies be returned. 'FALSE' by default. |
filenames |
if TRUE, return a data frame where the second column is the URI (usually file path) of the loaded assembly. 'FALSE' by default. |
the names of loaded assemblies
getLoadedAssemblies()getLoadedAssemblies()
Get the value of a global rSharp setting.
getRSharpSetting(settingName)getRSharpSetting(settingName)
settingName |
String name of the setting |
Value of the setting stored in rSharpEnv. If the setting does not exist, an error is thrown.
getRSharpSetting("nativePkgName")getRSharpSetting("nativePkgName")
Get the type code for a SEXP, as returned by the TYPEOF macro
getSexpType(sexp)getSexpType(sexp)
sexp |
an R object |
the type code, an integer, as defined in Rinternals.h
getSexpType(1) getSexpType("a") getSexpType(1:10)getSexpType(1) getSexpType("a") getSexpType(1:10)
Gets the value of a static field or property of a class
getStatic(type, name)getStatic(type, name)
type |
Type name, possibly namespace and assembly qualified type name, e.g. 'My.Namespace.MyClass,MyAssemblyName'. |
name |
the name of a field/property of the object |
An object resulting from the call. May be a 'NetObject' object, or a native R object for common types. Can be NULL.
testClassName <- getRSharpSetting("testObjectTypeName") getStatic(testClassName, "StaticPropertyIntegerOne")testClassName <- getRSharpSetting("testObjectTypeName") getStatic(testClassName, "StaticPropertyIntegerOne")
Gets the static fields for a type
getStaticFields(objOrType, contains = "")getStaticFields(objOrType, contains = "")
objOrType |
a ‘NetObject' object, or type name, possibly namespace and assembly qualified type name, e.g. ’My.Namespace.MyClass,MyAssemblyName'. |
contains |
a string that the property names returned must contain |
Gets the static members for a type
getStaticMembers(objOrType)getStaticMembers(objOrType)
objOrType |
a .NET object, or type name, possibly namespace and assembly qualified type name, e.g. 'My.Namespace.MyClass,MyAssemblyName'. |
cTypename <- getRSharpSetting("testCasesTypeName") getStaticMembers(cTypename)cTypename <- getRSharpSetting("testCasesTypeName") getStaticMembers(cTypename)
Gets the signature of a static member of a type
getStaticMemberSignature(typename, memberName)getStaticMemberSignature(typename, memberName)
typename |
type name, possibly namespace and assembly qualified type name, e.g. 'My.Namespace.MyClass,MyAssemblyName'. |
memberName |
The exact name of the member (i.e. field, property, method) to search for |
Gets the static methods for a type
getStaticMethods(objOrType, contains = "")getStaticMethods(objOrType, contains = "")
objOrType |
a ‘NetObject' object, or type name, possibly namespace and assembly qualified type name, e.g. ’My.Namespace.MyClass,MyAssemblyName'. |
contains |
a string that the property names returned must contain |
Gets the static properties for a type
getStaticProperties(objOrType, contains = "")getStaticProperties(objOrType, contains = "")
objOrType |
a ‘NetObject' object, or type name, possibly namespace and assembly qualified type name, e.g. ’My.Namespace.MyClass,MyAssemblyName'. |
contains |
a string that the property names returned must contain |
Returns a 'NetObject' object with external pointer to the object of type 'System.RuntimeType' that represents the type of the .NET object. To get a string representation of the type, call 'toStringNET' on the returned object.
getType(objOrTypename)getType(objOrTypename)
objOrTypename |
An object of class 'NEtObject' or a character vector of length one. It can be the full file name of the assembly to load, or a fully qualified assembly name, or as a last resort a partial name. |
A 'NetObject' to the pointer of 'System.RuntimeType' of 'objOrTypename'.
testClassName <- "ClrFacade.TestObject" type <- getType(testClassName) toStringNET(type) testObj <- newObjectFromName(testClassName) type <- getType(testObj) toStringNET(type)testClassName <- "ClrFacade.TestObject" type <- getType(testClassName) toStringNET(type) testObj <- newObjectFromName(testClassName) type <- getType(testObj) toStringNET(type)
Get a list of .NET type names exported by an assembly
getTypesInAssembly(assemblyName)getTypesInAssembly(assemblyName)
assemblyName |
the name of the assembly |
The names of the types exported by the assembly
getTypesInAssembly("ClrFacade")getTypesInAssembly("ClrFacade")
Inspect one or more R object to get information on its representation in the engine. This function is mostly useful for R/rSharp developers. It is derived from the 'showArgs' example in the R extension manual
inspectArgs(...)inspectArgs(...)
... |
one or more R objects |
NULL. Information is printed, not returned.
inspectArgs(1, "a", 1:10)inspectArgs(1, "a", 1:10)
Is the assembly loaded?
isAssemblyLoaded(assemblyName)isAssemblyLoaded(assemblyName)
assemblyName |
The name of the assembly, e.g. 'ClrFacade' |
TRUE if the assembly is loaded, FALSE otherwise
isAssemblyLoaded("ClrFacade")isAssemblyLoaded("ClrFacade")
Loads a .NET assembly.
loadAssembly(name)loadAssembly(name)
name |
a character vector of length one. It can be the full file name of the assembly to load, or a fully qualified assembly name, or as a last resort a partial name. |
Note that this is loaded in the single application domain that is created by rSharp, not a separate application domain.
Name of the loaded assembly, if successfull.
.C which this function wraps
## Not run: f <- file.path("SomeDirectory", "YourDotNetBinaryFile.dll") f <- path.expand(f) stopifnot(file.exists(f)) loadAssembly(f) ## End(Not run)## Not run: f <- file.path("SomeDirectory", "YourDotNetBinaryFile.dll") f <- path.expand(f) stopifnot(file.exists(f)) loadAssembly(f) ## End(Not run)
Base wrapper class for the pointers to .NET objects. Offers basic methods to interact with the .NET objects.
typeString representation of the type of the .NET object. Read-only
pointerThe external pointer to the .NET object. Read-only
new()
Initializes the object.
NetObject$new(pointer)
pointerThe external pointer to the .NET object
The initialized object
testClassName <- "ClrFacade.Tests.RefClasses.LevelOneClass"
o <- .External("r_create_clr_object", testClassName, PACKAGE = getRSharpSetting("nativePkgName"))
x <- newObjectFromName(testClassName)
print(x)
getFields()
List the fields of the object
NetObject$getFields(contains = "")
containsa string that the field names returned must contain
a list of names of the fields of the object
testClassName <- getRSharpSetting("testObjectTypeName")
testObj <- newObjectFromName(testClassName)
testObj$getFields()
testObj$getFields("ieldInt")
getStaticFields()
List the static fields of the object
NetObject$getStaticFields(contains = "")
containsa string that the field names returned must contain
a list of names of the static fields of the object
testClassName <- getRSharpSetting("testObjectTypeName")
testObj <- newObjectFromName(testClassName)
testObj$getStaticFields()
testObj$getStaticFields("ieldInt")
getProperties()
List the properties of the object
NetObject$getProperties(contains = "")
containsa string that the property names returned must contain
a list of names of the properties of the object
testClassName <- getRSharpSetting("testObjectTypeName")
testObj <- newObjectFromName(testClassName)
testObj$getProperties()
testObj$getProperties("One")
getStaticProperties()
List the static properties of the object
NetObject$getStaticProperties(contains = "")
containsa string that the property names returned must contain
a list of names of the static properties of the object
testClassName <- getRSharpSetting("testObjectTypeName")
testObj <- newObjectFromName(testClassName)
testObj$getStaticProperties()
testObj$getStaticProperties("One")
getMethods()
List the methods the object
NetObject$getMethods(contains = "")
containsa string that the methods names returned must contain
a list of names of the methods of the object
testClassName <- getRSharpSetting("testObjectTypeName")
testObj <- newObjectFromName(testClassName)
testObj$getMethods()
testObj$getMethods("Get")
getStaticMethods()
List the static methods the object
NetObject$getStaticMethods(contains = "")
containsa string that the methods names returned must contain
a list of names of the static methods of the object
testClassName <- getRSharpSetting("testObjectTypeName")
testObj <- newObjectFromName(testClassName)
testObj$getStaticMethods()
testObj$getStaticMethods("Get")
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.
NetObject$getMemberSignature(memberName)
memberNameThe exact name of the member (i.e. field, property, method) to search for
a character vector with summary information on the method/member signatures
testClassName <- getRSharpSetting("testObjectTypeName")
testObj <- newObjectFromName(testClassName)
testObj$getMemberSignature("set_PropertyIntegerOne")
testObj$getMemberSignature("FieldIntegerOne")
testObj$getMemberSignature("PropertyIntegerTwo")
call()
Call a method of the object
NetObject$call(methodName, ...)
methodNamethe name of a method of the object
...additional method arguments
An object resulting from the call. May be a 'NetObject' object, or a native R object for common types. Can be NULL.
testClassName <- getRSharpSetting("testObjectTypeName")
testObj <- newObjectFromName(testClassName)
testObj$call("GetFieldIntegerOne")
get()
Gets the value of a field or property of the object
NetObject$get(name)
namethe name of a field/property of the object
An object resulting from the call. May be a 'NetObject' object, or a native R object for common types. Can be NULL.
testClassName <- getRSharpSetting("testObjectTypeName")
testObj <- newObjectFromName(testClassName)
testObj$get("FieldIntegerOne")
set()
Sets the value of a field or property of the object.
NetObject$set(name, value, asInteger = FALSE)
namethe name of a field/property of the object
valuethe value to set the field with
asIntegerBoolean whether to convert the value to an integer. Used for cases where .NET signature requires an integer. Ignored if 'value' is not numeric.
testClassName <- getRSharpSetting("testObjectTypeName")
testObj <- newObjectFromName(testClassName)
testObj$set("FieldIntegerOne", as.integer(42))
.printLine()
DEPRECATED: Internal method for printing a line
NetObject$.printLine(entry, value = NULL, addTab = TRUE)
entryThe entry text
valueThe value to print
addTabWhether to add a tab before the entry
.printClass()
DEPRECATED: Internal method for printing class name
NetObject$.printClass()
print()
Prints a summary of the object.
NetObject$print()
## ------------------------------------------------ ## Method `NetObject$new` ## ------------------------------------------------ testClassName <- "ClrFacade.Tests.RefClasses.LevelOneClass" o <- .External("r_create_clr_object", testClassName, PACKAGE = getRSharpSetting("nativePkgName")) x <- newObjectFromName(testClassName) print(x) ## ------------------------------------------------ ## Method `NetObject$getFields` ## ------------------------------------------------ testClassName <- getRSharpSetting("testObjectTypeName") testObj <- newObjectFromName(testClassName) testObj$getFields() testObj$getFields("ieldInt") ## ------------------------------------------------ ## Method `NetObject$getStaticFields` ## ------------------------------------------------ testClassName <- getRSharpSetting("testObjectTypeName") testObj <- newObjectFromName(testClassName) testObj$getStaticFields() testObj$getStaticFields("ieldInt") ## ------------------------------------------------ ## Method `NetObject$getProperties` ## ------------------------------------------------ testClassName <- getRSharpSetting("testObjectTypeName") testObj <- newObjectFromName(testClassName) testObj$getProperties() testObj$getProperties("One") ## ------------------------------------------------ ## Method `NetObject$getStaticProperties` ## ------------------------------------------------ testClassName <- getRSharpSetting("testObjectTypeName") testObj <- newObjectFromName(testClassName) testObj$getStaticProperties() testObj$getStaticProperties("One") ## ------------------------------------------------ ## Method `NetObject$getMethods` ## ------------------------------------------------ testClassName <- getRSharpSetting("testObjectTypeName") testObj <- newObjectFromName(testClassName) testObj$getMethods() testObj$getMethods("Get") ## ------------------------------------------------ ## Method `NetObject$getStaticMethods` ## ------------------------------------------------ testClassName <- getRSharpSetting("testObjectTypeName") testObj <- newObjectFromName(testClassName) testObj$getStaticMethods() testObj$getStaticMethods("Get") ## ------------------------------------------------ ## Method `NetObject$getMemberSignature` ## ------------------------------------------------ testClassName <- getRSharpSetting("testObjectTypeName") testObj <- newObjectFromName(testClassName) testObj$getMemberSignature("set_PropertyIntegerOne") testObj$getMemberSignature("FieldIntegerOne") testObj$getMemberSignature("PropertyIntegerTwo") ## ------------------------------------------------ ## Method `NetObject$call` ## ------------------------------------------------ testClassName <- getRSharpSetting("testObjectTypeName") testObj <- newObjectFromName(testClassName) testObj$call("GetFieldIntegerOne") ## ------------------------------------------------ ## Method `NetObject$get` ## ------------------------------------------------ testClassName <- getRSharpSetting("testObjectTypeName") testObj <- newObjectFromName(testClassName) testObj$get("FieldIntegerOne") ## ------------------------------------------------ ## Method `NetObject$set` ## ------------------------------------------------ testClassName <- getRSharpSetting("testObjectTypeName") testObj <- newObjectFromName(testClassName) testObj$set("FieldIntegerOne", as.integer(42))## ------------------------------------------------ ## Method `NetObject$new` ## ------------------------------------------------ testClassName <- "ClrFacade.Tests.RefClasses.LevelOneClass" o <- .External("r_create_clr_object", testClassName, PACKAGE = getRSharpSetting("nativePkgName")) x <- newObjectFromName(testClassName) print(x) ## ------------------------------------------------ ## Method `NetObject$getFields` ## ------------------------------------------------ testClassName <- getRSharpSetting("testObjectTypeName") testObj <- newObjectFromName(testClassName) testObj$getFields() testObj$getFields("ieldInt") ## ------------------------------------------------ ## Method `NetObject$getStaticFields` ## ------------------------------------------------ testClassName <- getRSharpSetting("testObjectTypeName") testObj <- newObjectFromName(testClassName) testObj$getStaticFields() testObj$getStaticFields("ieldInt") ## ------------------------------------------------ ## Method `NetObject$getProperties` ## ------------------------------------------------ testClassName <- getRSharpSetting("testObjectTypeName") testObj <- newObjectFromName(testClassName) testObj$getProperties() testObj$getProperties("One") ## ------------------------------------------------ ## Method `NetObject$getStaticProperties` ## ------------------------------------------------ testClassName <- getRSharpSetting("testObjectTypeName") testObj <- newObjectFromName(testClassName) testObj$getStaticProperties() testObj$getStaticProperties("One") ## ------------------------------------------------ ## Method `NetObject$getMethods` ## ------------------------------------------------ testClassName <- getRSharpSetting("testObjectTypeName") testObj <- newObjectFromName(testClassName) testObj$getMethods() testObj$getMethods("Get") ## ------------------------------------------------ ## Method `NetObject$getStaticMethods` ## ------------------------------------------------ testClassName <- getRSharpSetting("testObjectTypeName") testObj <- newObjectFromName(testClassName) testObj$getStaticMethods() testObj$getStaticMethods("Get") ## ------------------------------------------------ ## Method `NetObject$getMemberSignature` ## ------------------------------------------------ testClassName <- getRSharpSetting("testObjectTypeName") testObj <- newObjectFromName(testClassName) testObj$getMemberSignature("set_PropertyIntegerOne") testObj$getMemberSignature("FieldIntegerOne") testObj$getMemberSignature("PropertyIntegerTwo") ## ------------------------------------------------ ## Method `NetObject$call` ## ------------------------------------------------ testClassName <- getRSharpSetting("testObjectTypeName") testObj <- newObjectFromName(testClassName) testObj$call("GetFieldIntegerOne") ## ------------------------------------------------ ## Method `NetObject$get` ## ------------------------------------------------ testClassName <- getRSharpSetting("testObjectTypeName") testObj <- newObjectFromName(testClassName) testObj$get("FieldIntegerOne") ## ------------------------------------------------ ## Method `NetObject$set` ## ------------------------------------------------ testClassName <- getRSharpSetting("testObjectTypeName") testObj <- newObjectFromName(testClassName) testObj$set("FieldIntegerOne", as.integer(42))
Create a new NetObject R6 object given the type name.
newObjectFromName(typename, ..., R6objectClass = NetObject)newObjectFromName(typename, ..., R6objectClass = NetObject)
typename |
type name, possibly namespace and assembly qualified type name, e.g. 'My.Namespace.MyClass,MyAssemblyName'. |
... |
additional method arguments passed to the object constructor via the call to .External |
R6objectClass |
the R6 class of the object to be created, defaults to 'NetObject'. Can be used to create custom R6 classes that inherit from 'NetObject'. |
a 'NetObject' R6 object
testClassName <- getRSharpSetting("testObjectTypeName") testObj <- newObjectFromName(testClassName) # object with a constructor that has parameters testObj <- newObjectFromName(testClassName, as.integer(123))testClassName <- getRSharpSetting("testObjectTypeName") testObj <- newObjectFromName(testClassName) # object with a constructor that has parameters testObj <- newObjectFromName(testClassName, as.integer(123))
Create a new external pointer to a .NET object given the type name.
newPointerFromName(typename, ...)newPointerFromName(typename, ...)
typename |
type name, possibly namespace and assembly qualified type name, e.g. 'My.Namespace.MyClass,MyAssemblyName'. |
... |
additional method arguments passed to the object constructor via the call to .External |
an external pointer to a .NET object
testClassName <- getRSharpSetting("testObjectTypeName") testPtr <- newPointerFromName(testClassName) # Now we can create a NetObject from the pointer testObj <- NetObject$new(testPtr)testClassName <- getRSharpSetting("testObjectTypeName") testPtr <- newPointerFromName(testClassName) # Now we can create a NetObject from the pointer testObj <- NetObject$new(testPtr)
This is roughly the equivalent of the traceback function of R.
printTraceback()printTraceback()
## Not run: callStatic( getRSharpSetting("testCasesTypeName"), " ThrowException", 10L ) # will be truncated by the Rf_error API printTraceback() # prints the full stack trace ## End(Not run)## Not run: callStatic( getRSharpSetting("testCasesTypeName"), " ThrowException", 10L ) # will be truncated by the Rf_error API printTraceback() # prints the full stack trace ## End(Not run)
Names of the settings stored in rSharpEnv Can be used with 'getRSharpSetting()'
rSharpSettingNamesrSharpSettingNames
An object of class character of length 9.
Gets the type of a .NET object resulting from converting an R object. This function is mostly for documentation purposes, but may be of use to end users.
rToDotNetType(x)rToDotNetType(x)
x |
An R object |
A list, with columns including mode, type, class, length and the string of the corresponding .NET type.
rToDotNetType(1)rToDotNetType(1)
Turn on/off the conversion of advanced data types with R.NET. This will turn off the conversion of classes such as dictionaries into R lists, as these are not bidirectional and you may want to see and manipulate external pointers to dictionaries in some circumstances.
setConvertAdvancedTypes(enable = TRUE)setConvertAdvancedTypes(enable = TRUE)
enable |
if true enable, otherwise disable |
library(rSharp) cTypename <- getRSharpSetting("testCasesTypeName") callStatic(cTypename, "CreateStringDictionary") setConvertAdvancedTypes(FALSE) callStatic(cTypename, "CreateStringDictionary")library(rSharp) cTypename <- getRSharpSetting("testCasesTypeName") callStatic(cTypename, "CreateStringDictionary") setConvertAdvancedTypes(FALSE) callStatic(cTypename, "CreateStringDictionary")
Sets the value of a field or property of an object or class
setStatic(type, name, value, asInteger = FALSE)setStatic(type, name, value, asInteger = FALSE)
type |
Type name, possibly namespace and assembly qualified type name, e.g. 'My.Namespace.MyClass,MyAssemblyName'. |
name |
the name of a field/property of the object |
value |
The value to set the field with |
asInteger |
Boolean whether to convert the value to an integer. Used for cases where .NET signature requires an integer. Ignored if 'value' is not numeric. |
testClassName <- getRSharpSetting("testObjectTypeName") setStatic(testClassName, "StaticPropertyIntegerOne", as.integer(42))testClassName <- getRSharpSetting("testObjectTypeName") setStatic(testClassName, "StaticPropertyIntegerOne", as.integer(42))
Calls the ToString method of an object as represented in the .NET. This function is here to help quickly test object equivalence from the R interpreter, for instance on the tricky topic of date-time conversions
toStringNET(x)toStringNET(x)
x |
any R object, which is converted to a .NET object on which to call ToString |
The string representation of the object in .NET
library(rSharp) dt <- as.POSIXct("2001-01-01 02:03:04", tz = "UTC") toStringNET(dt)library(rSharp) dt <- as.POSIXct("2001-01-01 02:03:04", tz = "UTC") toStringNET(dt)