netSetStatic: Set static property value

Description Usage Arguments Details Examples

View source: R/netSetStatic.R

Description

Sets a static property value from a .Net type name

Usage

1
netSetStatic(typeName, propertyName, value)

Arguments

typeName

Full .Net type name

propertyName

Property name to set value

value

value to set.

Details

Allows you to set a property value from .Net type name. The input value will be converted from R type to a .Net type. If the property value isn't a native C# type or a mapped conversion type you have to use an external pointer on .Net object. You can define custom converters in C# for that see RDotNetConverter class.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Not run: 
library(sharper)

pkgPath <- path.package("sharper")
f <- file.path(pkgPath, "tests", "AssemblyForTests.dll")
netLoadAssembly(f)

type <- "AssemblyForTests.StaticClass"
netSetStatic(type, "DoubleProperty", 1.23)
netGetStatic(type, "DoubleProperty")

netSetStatic(type, "Int32Property", 123L)
netGetStatic(type, "Int32Property")

netSetStatic(type, "DoubleArrayProperty", c(1.23, 1.24, 1.25))
netGetStatic(type, "DoubleArrayProperty")

netSetStatic(type, "Int32ArrayProperty", c(123L, 124L, 125L))
netGetStatic(type, "Int32ArrayProperty")

## End(Not run)

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