public string ToString(SpannerConnectionStringBuilder builder)
Returns the string representation of this KeyRange using the type conversion options specified in
SpannerConnectionStringBuilder. The string representation is only for diagnostic purposes
and the implementation may change over time.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe latest version of the \u003ccode\u003eKeyRange\u003c/code\u003e class in the Google.Cloud.Spanner.Data library is 5.0.0-beta05, with numerous previous versions also available for reference.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eKeyRange\u003c/code\u003e is an immutable class used to define a range of keys for selecting data from a table or index in Google Cloud Spanner.\u003c/p\u003e\n"],["\u003cp\u003eThe class has properties \u003ccode\u003eBeginAt\u003c/code\u003e, \u003ccode\u003eBeginInclusive\u003c/code\u003e, \u003ccode\u003eEnd\u003c/code\u003e, and \u003ccode\u003eEndInclusive\u003c/code\u003e, which define the start and end points of the range, and whether those points are inclusive or exclusive.\u003c/p\u003e\n"],["\u003cp\u003eStatic methods like \u003ccode\u003eClosedClosed\u003c/code\u003e, \u003ccode\u003eClosedOpen\u003c/code\u003e, \u003ccode\u003eOpenClosed\u003c/code\u003e, and \u003ccode\u003eOpenOpen\u003c/code\u003e are provided for creating new \u003ccode\u003eKeyRange\u003c/code\u003e instances with different combinations of inclusive and exclusive boundaries.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eToString(SpannerConnectionStringBuilder)\u003c/code\u003e allows for a string representation of the \u003ccode\u003eKeyRange\u003c/code\u003e to be created, for diagnostic purposes, based on a specified \u003ccode\u003eSpannerConnectionStringBuilder\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Google.Cloud.Spanner.Data - Class KeyRange (5.1.0)\n\nVersion latestkeyboard_arrow_down\n\n- [5.1.0 (latest)](/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.KeyRange)\n- [5.0.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/5.0.0/Google.Cloud.Spanner.Data.KeyRange)\n- [4.6.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/4.6.0/Google.Cloud.Spanner.Data.KeyRange)\n- [4.5.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/4.5.0/Google.Cloud.Spanner.Data.KeyRange)\n- [4.4.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/4.4.0/Google.Cloud.Spanner.Data.KeyRange)\n- [4.3.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/4.3.0/Google.Cloud.Spanner.Data.KeyRange)\n- [4.2.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/4.2.0/Google.Cloud.Spanner.Data.KeyRange)\n- [4.1.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/4.1.0/Google.Cloud.Spanner.Data.KeyRange)\n- [4.0.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/4.0.0/Google.Cloud.Spanner.Data.KeyRange)\n- [3.15.1](/dotnet/docs/reference/Google.Cloud.Spanner.Data/3.15.1/Google.Cloud.Spanner.Data.KeyRange)\n- [3.14.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/3.14.0/Google.Cloud.Spanner.Data.KeyRange)\n- [3.13.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/3.13.0/Google.Cloud.Spanner.Data.KeyRange)\n- [3.12.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/3.12.0/Google.Cloud.Spanner.Data.KeyRange)\n- [3.11.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/3.11.0/Google.Cloud.Spanner.Data.KeyRange)\n- [3.10.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/3.10.0/Google.Cloud.Spanner.Data.KeyRange)\n- [3.9.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/3.9.0/Google.Cloud.Spanner.Data.KeyRange)\n- [3.8.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/3.8.0/Google.Cloud.Spanner.Data.KeyRange)\n- [3.7.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/3.7.0/Google.Cloud.Spanner.Data.KeyRange)\n- [3.6.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/3.6.0/Google.Cloud.Spanner.Data.KeyRange)\n- [3.5.0](/dotnet/docs/reference/Google.Cloud.Spanner.Data/3.5.0/Google.Cloud.Spanner.Data.KeyRange) \n\n public sealed class KeyRange\n\nReference documentation and code samples for the Google.Cloud.Spanner.Data class KeyRange.\n\nImmutable class that defines a range of keys to select from a table or index. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e KeyRange \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.Spanner.Data](/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data)\n\nAssembly\n--------\n\nGoogle.Cloud.Spanner.Data.dll\n\nProperties\n----------\n\n### BeginAt\n\n public Key BeginAt { get; }\n\nThe start of the key range. It can be inclusive or exclusive, depending on the value of [BeginInclusive](/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.KeyRange#Google_Cloud_Spanner_Data_KeyRange_BeginInclusive).\n\n### BeginInclusive\n\n public bool BeginInclusive { get; }\n\nTrue if the start of the key range is inclusive, and false otherwise.\n\n### End\n\n public Key End { get; }\n\nThe end of the key range. It can be inclusive or exclusive, depending on the value of [EndInclusive](/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.KeyRange#Google_Cloud_Spanner_Data_KeyRange_EndInclusive).\n\n### EndInclusive\n\n public bool EndInclusive { get; }\n\nTrue if the end of the key range is inclusive, and false if the end is exclusive.\n\nMethods\n-------\n\n### ClosedClosed(Key, Key)\n\n public static KeyRange ClosedClosed(Key begin, Key end)\n\nCreates a new KeyRange with an inclusive begin and inclusive end.\n\n### ClosedOpen(Key, Key)\n\n public static KeyRange ClosedOpen(Key begin, Key end)\n\nCreates a new KeyRange with an inclusive begin and exclusive end.\n\n### OpenClosed(Key, Key)\n\n public static KeyRange OpenClosed(Key begin, Key end)\n\nCreates a new KeyRange with an exclusive begin and inclusive end.\n\n### OpenOpen(Key, Key)\n\n public static KeyRange OpenOpen(Key begin, Key end)\n\nCreates a new KeyRange with an exclusive begin and exclusive end.\n\n### ToString(SpannerConnectionStringBuilder)\n\n public string ToString(SpannerConnectionStringBuilder builder)\n\nReturns the string representation of this KeyRange using the type conversion options specified in\n[SpannerConnectionStringBuilder](/dotnet/docs/reference/Google.Cloud.Spanner.Data/latest/Google.Cloud.Spanner.Data.SpannerConnectionStringBuilder). The string representation is only for diagnostic purposes\nand the implementation may change over time."]]