public sealed class FirestoreEnumNameConverter<T> : IFirestoreConverter<T> where T : struct, Enum
Reference documentation and code samples for the Firestore API class FirestoreEnumNameConverter
Custom converter which uses enum value names instead of integer values as the Firestore representation.
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.
Methods
FromFirestore(object)
public T FromFirestore(object value)
Converts a value from its Firestore representation.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe latest version of the Firestore API class \u003ccode\u003eFirestoreEnumNameConverter\u003c/code\u003e is 3.10.0, with documentation available for previous versions down to 2.3.1.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eFirestoreEnumNameConverter\u003c/code\u003e is a custom converter that uses enum value names instead of integer values for Firestore representation, but it must be manually configured.\u003c/p\u003e\n"],["\u003cp\u003eThis converter, currently case-sensitive, facilitates converting enum values to and from their Firestore representations via the \u003ccode\u003eToFirestore\u003c/code\u003e and \u003ccode\u003eFromFirestore\u003c/code\u003e methods respectively.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eToFirestore\u003c/code\u003e method may return an undefined result if multiple enum values map to the same integer, and it throws an exception if the provided value isn't a named enum element.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eFirestoreEnumNameConverter\u003c/code\u003e implements the \u003ccode\u003eIFirestoreConverter\u003c/code\u003e interface and has a type parameter \u003ccode\u003eT\u003c/code\u003e that represents the specific enum type to be converted.\u003c/p\u003e\n"]]],[],null,["# Firestore API - Class FirestoreEnumNameConverter<T> (3.10.0)\n\nVersion latestkeyboard_arrow_down\n\n- [3.10.0 (latest)](/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.FirestoreEnumNameConverter-1)\n- [3.9.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.9.0/Google.Cloud.Firestore.FirestoreEnumNameConverter-1)\n- [3.8.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.8.0/Google.Cloud.Firestore.FirestoreEnumNameConverter-1)\n- [3.7.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.7.0/Google.Cloud.Firestore.FirestoreEnumNameConverter-1)\n- [3.6.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.6.0/Google.Cloud.Firestore.FirestoreEnumNameConverter-1)\n- [3.5.1](/dotnet/docs/reference/Google.Cloud.Firestore/3.5.1/Google.Cloud.Firestore.FirestoreEnumNameConverter-1)\n- [3.4.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.4.0/Google.Cloud.Firestore.FirestoreEnumNameConverter-1)\n- [3.3.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.3.0/Google.Cloud.Firestore.FirestoreEnumNameConverter-1)\n- [3.2.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.2.0/Google.Cloud.Firestore.FirestoreEnumNameConverter-1)\n- [3.1.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.1.0/Google.Cloud.Firestore.FirestoreEnumNameConverter-1)\n- [3.0.0](/dotnet/docs/reference/Google.Cloud.Firestore/3.0.0/Google.Cloud.Firestore.FirestoreEnumNameConverter-1)\n- [2.5.0](/dotnet/docs/reference/Google.Cloud.Firestore/2.5.0/Google.Cloud.Firestore.FirestoreEnumNameConverter-1)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.Firestore/2.4.0/Google.Cloud.Firestore.FirestoreEnumNameConverter-1)\n- [2.3.1](/dotnet/docs/reference/Google.Cloud.Firestore/2.3.1/Google.Cloud.Firestore.FirestoreEnumNameConverter-1) \n\n public sealed class FirestoreEnumNameConverter\u003cT\u003e : IFirestoreConverter\u003cT\u003e where T : struct, Enum\n\nReference documentation and code samples for the Firestore API class FirestoreEnumNameConverter\n\n\u003cbr /\u003e\n\nCustom converter which uses enum value names instead of integer values as the Firestore representation.\nThis converter is not used by default; it must be configured in the same way as any other custom converter. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e FirestoreEnumNameConverter\\\u003cT\\\u003e \n\nImplements\n----------\n\n[IFirestoreConverter](/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore.IFirestoreConverter-1) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Firestore](/dotnet/docs/reference/Google.Cloud.Firestore/latest/Google.Cloud.Firestore)\n\nAssembly\n--------\n\nGoogle.Cloud.Firestore.dll\n\nRemarks\n-------\n\n\nCurrently this is always case-sensitive, with no customization of the names used. In future releases\nwe may introduce further ways to configure this converter, but the default behavior will remain the same.\n\n\nWhen the same enum value has multiple names, no guarantee is made about which one is returned, although both\nare accepted for conversion back to enum values. You are strongly encouraged not to use multiple names for the\nsame value.\n\nMethods\n-------\n\n### FromFirestore(object)\n\n public T FromFirestore(object value)\n\nConverts a value from its Firestore representation.\n\n### ToFirestore(T)\n\n public object ToFirestore(T value)\n\nConverts an enum value to its name.\n\n**Remarks** \nIf multiple values in the enum map to the same integer, it is undefined which will be returned.\nIf the value is not a named enum element, an exception is thrown, even if the enum is\ndecorated with [FlagsAttribute](https://learn.microsoft.com/dotnet/api/system.flagsattribute)."]]