Utility

public sealed class Utility
Class with useful static methods.

Methods

DocumentAngleTolerance

#
Returns the Angle Tolerance in degrees for the model document
public static double DocumentAngleTolerance()

DocumentTolerance

#
Returns the Absolute Tolerance of the model document
public static double DocumentTolerance()

DocumentUnits

#
Returns the unit system for the model document
public static string DocumentUnits()

FixNewlines

#
Make sure all newlines in a string have a specific pattern.
public static string FixNewlines(
text,
Text to fix.
newLinePattern
Newline string to use.
)
Fixed string

FixNewlines

#
Make sure all newlines in a string adhere to the current platform standard.
public static string FixNewlines(
text
Text to fix.
)

InvokeDownloader

#
Start an asynchronous download operation. The download runs in a separate appdomain. After triggering that process this method returns immediately.
public static void InvokeDownloader(
sourceUri,
Uri of data to download.
targetUri,
Uri of file on local disk where to store downloaded data.
silent
If true the download will not display any user interface.
)

InvokeGetter

#
Call a getter property via its name.
public static object InvokeGetter(
target,
Object to invoke on.
property
Name of property to invoke.
)
The return value of the method.

InvokeGetterSafe

#
Call a getter property via its name. No exceptions are thrown.
public static object InvokeGetterSafe(
target,
Object to invoke on.
property
Name of property to invoke.
)
The return value of the method.

InvokeMethod

#
Call a method via its name.
public static object InvokeMethod(
target,
Object to invoke on.
method,
Name of method to invoke.
params object[]
params
Arguments for method.
)
The return value of the method.

InvokeMethod

#
Call a method via its name.
public static object InvokeMethod(
target,
Object to invoke on.
method
Name of method to invoke.
)
The return value of the method.

InvokeMethodSafe

#
Call a method via its name. No exceptions are thrown.
public static object InvokeMethodSafe(
target,
Object to invoke on.
method,
Name of method to invoke.
params object[]
params
Arguments for method.
)
The return value of the method.

InvokeMethodSafe

#
Call a method via its name. No exceptions are thrown.
public static object InvokeMethodSafe(
target,
Object to invoke on.
method
Name of method to invoke.
)
The return value of the method.

InvokeSetter

#
Call a setter property via its name.
public static void InvokeSetter(
target,
Object to invoke on.
property,
Name of property to invoke.
value
)

InvokeSetterSafe

#
Call a setter property via its name. No exceptions are thrown.
public static void InvokeSetterSafe(
target,
Object to invoke on.
property,
Name of property to invoke.
value
)

LikeOperator

#
Exposes the VB.NET Like operator as a static method.
public static bool LikeOperator(
text,
pattern
)

SetDefaultTolerances

#
Utility function to set absolute and angle tolerance fields.
public static void SetDefaultTolerances(
absoluteTolerance,
Value to set model absolute tolerance
angleToleranceDegrees
Value to set model angle tolerance in degrees
)

SetDefaultUnits

#
Utility function to set model unit fields
public static void SetDefaultUnits(
modelUnits
Value to set default model units
)

TernaryIf<T>

#
Type safe implementation of the IIf conditional statement.
public static T TernaryIf<T>(
condition,
If True, A is returned.
T
A,
Value to return when condition evaluates to true.
T
B
Value to return when condition evaluates to false.
)
obsoleteTernary conditionals are now part of the standard C# and VB language spec. Consider using those instead.