Skip to content

Commit 813e25d

Browse files
committed
remove readonly from AsPrimitive
1 parent 2b916af commit 813e25d

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

sandbox/Generated/UnitGenerator/UnitGenerator.SourceGenerator/FileGenerate.A.Generated.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace FileGenerate
1111
{
1212
readonly int value;
1313

14-
public readonly int AsPrimitive() => value;
14+
public int AsPrimitive() => value;
1515

1616
public A(int value)
1717
{
@@ -142,4 +142,6 @@ public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext co
142142
}
143143
}
144144
}
145+
}
146+
}
145147
}

sandbox/Generated/UnitGenerator/UnitGenerator.SourceGenerator/FileGenerate.B.Generated.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace FileGenerate
1111
{
1212
readonly string value;
1313

14-
public readonly string AsPrimitive() => value;
14+
public string AsPrimitive() => value;
1515

1616
public B(string value)
1717
{
@@ -142,4 +142,6 @@ public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext co
142142
}
143143
}
144144
}
145+
}
146+
}
145147
}

src/UnitGenerator/CodeTemplate.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public virtual string TransformText()
6060
this.Write(this.ToStringHelper.ToStringWithCulture(HasFlag(UnitGenerateOptions.Comparable) ? $", IComparable<{Name}>" : ""));
6161
this.Write("\r\n {\r\n readonly ");
6262
this.Write(this.ToStringHelper.ToStringWithCulture(Type));
63-
this.Write(" value;\r\n\r\n public readonly ");
63+
this.Write(" value;\r\n\r\n public ");
6464
this.Write(this.ToStringHelper.ToStringWithCulture(Type));
6565
this.Write(" AsPrimitive() => value;\r\n\r\n public ");
6666
this.Write(this.ToStringHelper.ToStringWithCulture(Name));

src/UnitGenerator/CodeTemplate.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace <#= Namespace #>
3232
{
3333
readonly <#= Type #> value;
3434

35-
public readonly <#= Type #> AsPrimitive() => value;
35+
public <#= Type #> AsPrimitive() => value;
3636

3737
public <#= Name #>(<#= Type #> value)
3838
{

0 commit comments

Comments
 (0)