< Summary

Information
Class: System.Text.Json.JsonNamingPolicy
Assembly: System.Text.Json
File(s): C:\h\w\B31A098C\w\BB5A0A33\e\runtime-utils\Runner\runtime\src\libraries\System.Text.Json\Common\JsonNamingPolicy.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 6
Coverable lines: 6
Total lines: 53
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor()100%110%

File(s)

C:\h\w\B31A098C\w\BB5A0A33\e\runtime-utils\Runner\runtime\src\libraries\System.Text.Json\Common\JsonNamingPolicy.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4namespace System.Text.Json
 5{
 6    /// <summary>
 7    /// Determines the naming policy used to convert a string-based name to another format, such as a camel-casing forma
 8    /// </summary>
 9#if BUILDING_SOURCE_GENERATOR
 10    internal
 11#else
 12    public
 13#endif
 14    abstract class JsonNamingPolicy
 15    {
 16        /// <summary>
 17        /// Initializes a new instance of <see cref="JsonNamingPolicy"/>.
 18        /// </summary>
 019        protected JsonNamingPolicy() { }
 20
 21        /// <summary>
 22        /// Returns the naming policy for camel-casing.
 23        /// </summary>
 024        public static JsonNamingPolicy CamelCase { get; } = new JsonCamelCaseNamingPolicy();
 25
 26        /// <summary>
 27        /// Returns the naming policy for lower snake-casing.
 28        /// </summary>
 029        public static JsonNamingPolicy SnakeCaseLower { get; } = new JsonSnakeCaseLowerNamingPolicy();
 30
 31        /// <summary>
 32        /// Returns the naming policy for upper snake-casing.
 33        /// </summary>
 034        public static JsonNamingPolicy SnakeCaseUpper { get; } = new JsonSnakeCaseUpperNamingPolicy();
 35
 36        /// <summary>
 37        /// Returns the naming policy for lower kebab-casing.
 38        /// </summary>
 039        public static JsonNamingPolicy KebabCaseLower { get; } = new JsonKebabCaseLowerNamingPolicy();
 40
 41        /// <summary>
 42        /// Returns the naming policy for upper kebab-casing.
 43        /// </summary>
 044        public static JsonNamingPolicy KebabCaseUpper { get; } = new JsonKebabCaseUpperNamingPolicy();
 45
 46        /// <summary>
 47        /// When overridden in a derived class, converts the specified name according to the policy.
 48        /// </summary>
 49        /// <param name="name">The name to convert.</param>
 50        /// <returns>The converted name.</returns>
 51        public abstract string ConvertName(string name);
 52    }
 53}