Class IOHelperExtensions
Provides extension methods for IIOHelper for common IO operations.
Inheritance
object
Namespace: Umbraco.Extensions
Assembly: Umbraco.Core.dll
Syntax
public static class IOHelperExtensions
Methods
View SourceCreateRandomFileName(IIOHelper)
Creates a random temporary file name for testing purposes.
Declaration
public static string CreateRandomFileName(this IIOHelper ioHelper)
Parameters
| Type | Name | Description |
|---|---|---|
| IIOHelper | ioHelper | The IO helper. |
Returns
| Type | Description |
|---|---|
| string | A random file name in the format "umbraco-test.{8-char-guid}". |
ResolveRelativeOrVirtualUrl(IIOHelper, string?)
Will resolve a virtual path URL to an absolute path, else if it is not a virtual path (i.e. starts with ~/) then it will just return the path as-is (relative).
Declaration
public static string? ResolveRelativeOrVirtualUrl(this IIOHelper ioHelper, string? path)
Parameters
| Type | Name | Description |
|---|---|---|
| IIOHelper | ioHelper | |
| string | path |
Returns
| Type | Description |
|---|---|
| string |
TryCreateDirectory(IIOHelper, string)
Tries to create a directory.
Declaration
public static bool TryCreateDirectory(this IIOHelper ioHelper, string dir)
Parameters
| Type | Name | Description |
|---|---|---|
| IIOHelper | ioHelper | The IOHelper. |
| string | dir | the directory path. |
Returns
| Type | Description |
|---|---|
| bool | true if the directory was created, false otherwise. |