Skip to content

Commit

Permalink
Make JsonPropertyNameAttribute.Name readonly (dotnet/corefx#37829)
Browse files Browse the repository at this point in the history
Rename ctor arg to name

Fixes: dotnet/corefx#37552

Commit migrated from dotnet/corefx@e8990ae
  • Loading branch information
maryamariyan authored and ahsonkhan committed May 28, 2019
1 parent 17c9d54 commit 9ba8b91
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ namespace System.Text.Json.Serialization
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property, AllowMultiple = false)]
public sealed class JsonPropertyNameAttribute : System.Text.Json.Serialization.JsonAttribute
{
public JsonPropertyNameAttribute(string propertyName) { }
public string Name { get; set; }
public JsonPropertyNameAttribute(string name) { }
public string Name { get; }
}

public abstract partial class JsonNamingPolicy
Expand Down
4 changes: 2 additions & 2 deletions src/libraries/System.Text.Json/ref/System.Text.Json.cs
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,8 @@ protected JsonNamingPolicy() { }
[System.AttributeUsageAttribute(System.AttributeTargets.Property, AllowMultiple=false)]
public sealed partial class JsonPropertyNameAttribute : System.Text.Json.Serialization.JsonAttribute
{
public JsonPropertyNameAttribute(string propertyName) { }
public string Name { get { throw null; } set { } }
public JsonPropertyNameAttribute(string name) { }
public string Name { get { throw null; } }
}
public static partial class JsonSerializer
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ public sealed class JsonPropertyNameAttribute : JsonAttribute
/// <summary>
/// Initializes a new instance of <see cref="JsonPropertyNameAttribute"/> with the specified property name.
/// </summary>
/// <param name="propertyName">The name of the property.</param>
public JsonPropertyNameAttribute(string propertyName)
/// <param name="name">The name of the property.</param>
public JsonPropertyNameAttribute(string name)
{
Name = propertyName;
Name = name;
}

/// <summary>
/// The name of the property.
/// </summary>
public string Name { get; set; }
public string Name { get; }
}
}

0 comments on commit 9ba8b91

Please sign in to comment.