public static class ComputeEnumHelpersReference documentation and code samples for the Compute Engine v1 API class ComputeEnumHelpers.
Helper methods for conversion between the enums within the Compute API and the string representations used on the wire.
Namespace
Google.Cloud.Compute.V1Assembly
Google.Cloud.Compute.V1.dll
Methods
Format<TEnum>(TEnum)
public static string Format<TEnum>(TEnum value) where TEnum : struct, EnumConverts the given enum value into the wire representation as a string.
| Parameter | |
|---|---|
| Name | Description |
value |
TEnumThe value to convert. |
| Returns | |
|---|---|
| Type | Description |
string |
The string representation of the enum value. |
| Type Parameter | |
|---|---|
| Name | Description |
TEnum |
The enum type to convert to a string. |
| Exceptions | |
|---|---|
| Type | Description |
ArgumentException |
The enum value is not defined, so it has no known wire representation. |
Parse<TEnum>(string)
public static TEnum Parse<TEnum>(string value) where TEnum : struct, EnumParses the given string value as the wire representation of a
TEnum value, throwing an exception if the value cannot be parsed.
| Parameter | |
|---|---|
| Name | Description |
value |
stringThe text value to parse. |
| Returns | |
|---|---|
| Type | Description |
TEnum |
The parsed value. |
| Type Parameter | |
|---|---|
| Name | Description |
TEnum |
The enum type to convert |
| Exceptions | |
|---|---|
| Type | Description |
ArgumentException |
|
TryParse<TEnum>(string, out TEnum)
public static bool TryParse<TEnum>(string value, out TEnum result) where TEnum : struct, EnumAttempts to parse the given string value as the wire representation of
a TEnum value.
| Parameters | |
|---|---|
| Name | Description |
value |
stringThe text value to parse. |
result |
TEnumThe output parameter to store the result in. This will be the
parsed value of |
| Returns | |
|---|---|
| Type | Description |
bool |
true if the value was successfully parsed; false otherwise |
| Type Parameter | |
|---|---|
| Name | Description |
TEnum |
The enum type to convert |