clrIs: Check whether an object is of a certain type

Description Usage Arguments Value Examples

Description

Check whether an object is of a certain type. This function is meant to match the behavior of the 'is' keyword in C#.

Usage

1
clrIs(obj, type)

Arguments

obj

an object

type

the object type to check for. It can be a character, of a object of CLR type System.RuntimeType

Value

TRUE or FALSE

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
library(rClr)
testClassName <- "Rclr.TestObject";
(testObj <- clrNew(testClassName))
clrIs(testObj, testClassName)
clrIs(testObj, 'System.Object')
clrIs(testObj, 'System.Double')
(testObj <- clrNew('Rclr.TestMethodBinding'))
# Test for interface definitions
clrIs(testObj, 'Rclr.ITestMethodBindings')
clrIs(testObj, clrGetType('Rclr.ITestMethodBindings'))
clrIs(testObj, clrGetType('Rclr.TestMethodBinding'))
clrIs(testObj, clrGetType('System.Reflection.Assembly'))

## End(Not run)

jmp75/rClr documentation built on June 11, 2019, 6:45 p.m.