[[["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 \u003ccode\u003eServiceContextUtils\u003c/code\u003e class provides helper methods for working with a \u003ccode\u003eServiceContext\u003c/code\u003e struct, as part of the Google.Cloud.Diagnostics.Common namespace.\u003c/p\u003e\n"],["\u003cp\u003eThe class includes two constant string fields: \u003ccode\u003eServiceContextServiceKey\u003c/code\u003e, which is the name of the service field, and \u003ccode\u003eServiceContextVersionKey\u003c/code\u003e, which represents the name of the version field within a \u003ccode\u003eServiceContext\u003c/code\u003e Struct.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eCreateServiceContext\u003c/code\u003e method creates a \u003ccode\u003eServiceContext\u003c/code\u003e Struct using a provided service name and version.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version available for \u003ccode\u003eGoogle.Cloud.Diagnostics.Common\u003c/code\u003e is \u003ccode\u003e5.2.0\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Google.Cloud.Diagnostics.Common - Class ServiceContextUtils (5.3.0)\n\nVersion latestkeyboard_arrow_down\n\n- [5.3.0 (latest)](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.ServiceContextUtils)\n- [5.2.0](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.2.0/Google.Cloud.Diagnostics.Common.ServiceContextUtils)\n- [5.1.0](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.1.0/Google.Cloud.Diagnostics.Common.ServiceContextUtils)\n- [5.0.0](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.0.0/Google.Cloud.Diagnostics.Common.ServiceContextUtils)\n- [4.4.0](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/4.4.0/Google.Cloud.Diagnostics.Common.ServiceContextUtils)\n- [4.3.1](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/4.3.1/Google.Cloud.Diagnostics.Common.ServiceContextUtils) \n\n public static class ServiceContextUtils\n\nReference documentation and code samples for the Google.Cloud.Diagnostics.Common class ServiceContextUtils.\n\nHelpers for working with a ServiceContext Struct. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e ServiceContextUtils \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.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Diagnostics.Common](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common)\n\nAssembly\n--------\n\nGoogle.Cloud.Diagnostics.Common.dll\n\nFields\n------\n\n### ServiceContextServiceKey\n\n public const string ServiceContextServiceKey = \"service\"\n\nThe name of the service name field in a ServiceContext [Struct](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.WellKnownTypes.Struct.html).\n\n### ServiceContextVersionKey\n\n public const string ServiceContextVersionKey = \"version\"\n\nThe name of the version field in a ServiceContext [Struct](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.WellKnownTypes.Struct.html).\n\nMethods\n-------\n\n### CreateServiceContext(string, string)\n\n public static Struct CreateServiceContext(string serviceName, string version)\n\nCreates a ServiceContext [Struct](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.WellKnownTypes.Struct.html) from a given service name and version.\n\n**Remarks** \nSee \u003chttps://cloud.google.com/error-reporting/reference/rest/v1beta1/ServiceContext\u003e"]]