Stay organized with collections
Save and categorize content based on your preferences.
Firebase.Firestore.FirestoreEnumNameConverter< T >
Custom converter which uses enum value names instead of integer values as the Firestore representation.
Summary
This converter is not used by default; it must be configured in the same way as any other custom converter.
Currently this is always case-sensitive, with no customization of the names used. In future releases we may introduce further ways to configure this converter, but the default behavior will remain the same.
When the same enum value has multiple names, no guarantee is made about which one is returned, although both are accepted for conversion back to enum values. You are strongly encouraged not to use multiple names for the same value.
Details |
Template Parameters |
T
|
The enum type to convert
|
|
Inheritance
Inherits from: FirestoreConverter< T >
Public functions
|
FromFirestore(object value)
|
override T
|
ToFirestore(T value)
|
override object
Converts an enum value to its name.
|
Public functions
FromFirestore
override T FromFirestore(
object value
)
ToFirestore
override object ToFirestore(
T value
)
Converts an enum value to its name.
If multiple values in the enum map to the same integer, it is undefined which will be returned. If the value is not a named enum element, an exception is thrown, even if the enum is decorated with FlagsAttribute.
Details |
Parameters |
value
|
The value to convert.
|
|
Exceptions |
ArgumentException
|
The given value is not a named value within the enum.
|
|
Returns
|
The name of the value.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2021-06-17 UTC.
[null,null,["Last updated 2021-06-17 UTC."],[],[],null,["Firebase.Firestore.FirestoreEnumNameConverter\\\u003c T \\\u003e\n\nCustom converter which uses enum value names instead of integer values as the [Firestore](/docs/reference/unity/namespace/firebase/firestore#namespace_firebase_1_1_firestore) representation.\n\nSummary\n\nThis converter is not used by default; it must be configured in the same way as any other custom converter.\n\nCurrently this is always case-sensitive, with no customization of the names used. In future releases we may introduce further ways to configure this converter, but the default behavior will remain the same.\n\nWhen the same enum value has multiple names, no guarantee is made about which one is returned, although both are accepted for conversion back to enum values. You are strongly encouraged not to use multiple names for the same value.\n\n\u003cbr /\u003e\n\nInheritanceInherits from: FirestoreConverter\\\u003c T \\\u003e\n\nPublic functions \n\nFromFirestore \n\n```c#\noverride T FromFirestore(\n object value\n)\n``` \n\nToFirestore \n\n```c#\noverride object ToFirestore(\n T value\n)\n``` \nConverts an enum value to its name.\n\nIf multiple values in the enum map to the same integer, it is undefined which will be returned. If the value is not a named enum element, an exception is thrown, even if the enum is decorated with FlagsAttribute.\n\n\u003cbr /\u003e"]]