netGet: Get property value

Description Usage Arguments Details Value Examples

View source: R/netGet.R

Description

Gets a property value from a .Net object

Usage

1
netGet(x, propertyName, wrap = FALSE)

Arguments

x

.Net object

propertyName

Property name to get value

wrap

Specify if you want to wrap externalptr .Net object into NetObject R6 object. 'FALSEā€œ by default.

Details

Allows you to get a property value for a .Net object. The result will be converted if the type mapping is defined. All native C# types are mapped to R types but you can define custom converters in C# for that see the C# RDotNetConverter class.

If you decide to set wrap to TRUE this function supports the NetObject R6 class and all inherited. The function result if no converter has been found will return a NetObject of an inherited best type instead of a raw externalptr. For more details about inherited NetObject class please see netGenerateR6 function.

Value

Returns the .Net property value. If a converter has been defined between the .Net type and a R type, the R type will be returned. Otherwise an externalptr or a NetObject if wrap is set to TRUE.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
library(sharper)

package_folder = path.package("sharper")

x <- netNew("AssemblyForTests.DefaultCtorData")
netSet(x, "Name", "foo")
x_name <- netGet(x, "Name")

netSet(x, "Integers", c(12L, 23L))
x_integers <- netGet(x, "Integers")


## End(Not run)

fdieulle/sharper documentation built on Aug. 1, 2020, 4:19 p.m.