Class Converter
Helper functions for common converter scenarios
Inheritance
Inherited Members
Namespace: EPiServer.DataAbstraction
Assembly: EPiServer.dll
Version: 8.11.0Syntax
public class Converter
Constructors
Converter()
Declaration
public Converter()
Methods
ToIntZero(Object)
Returns 0 if parameter is anything else than of type System.Int32, also supports converting of False to 0 and True to 1.
Declaration
public static int ToIntZero(object val)
Parameters
Type | Name | Description |
---|---|---|
System.Object | val |
Returns
Type | Description |
---|---|
System.Int32 |
ToScriptSafeIdentifier(String)
Make string safe to be used as a identifier in a script block, by replacing any characters that would invalidate the script with script-safe characters.
Declaration
public static string ToScriptSafeIdentifier(string s)
Parameters
Type | Name | Description |
---|---|---|
System.String | s | String that needs to be script-safe |
Returns
Type | Description |
---|---|
System.String | Script-safe identifier |
ToScriptSafeString(String)
Make a string safe to be embedded into a script block, by replacing any characters that would invalidate the script with script-safe characters.
Declaration
public static string ToScriptSafeString(string s)
Parameters
Type | Name | Description |
---|---|---|
System.String | s | Text that needs to be script-safe |
Returns
Type | Description |
---|---|
System.String | Script-safe text |
ToStringEmpty(Object)
Returns String.Empty if parameter is anything else than of type System.String.
Declaration
public static string ToStringEmpty(object val)
Parameters
Type | Name | Description |
---|---|---|
System.Object | val |
Returns
Type | Description |
---|---|
System.String |
ToStringNull(Object)
Tries to cast to a string.
Declaration
public static string ToStringNull(object val)
Parameters
Type | Name | Description |
---|---|---|
System.Object | val | The object to cast. |
Returns
Type | Description |
---|---|
System.String |
|
ToSystemNull(Object)
Converts from System.DBNull
to null
.
Declaration
public static object ToSystemNull(object val)
Parameters
Type | Name | Description |
---|---|---|
System.Object | val | The object to convert. |
Returns
Type | Description |
---|---|
System.Object |
|