File tree 1 file changed +15
-0
lines changed
CodeGen/Generators/NanoFrameworkGen 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,7 @@ private void GenerateConversionProperties()
131
131
/// <summary>
132
132
/// Gets a <see cref=""double""/> value of this quantity converted into <see cref=""{ _unitEnumName } .{ unit . SingularName } ""/>
133
133
/// </summary>" ) ;
134
+ Writer . WLIfText ( 2 , GetObsoleteAttributeOrNull ( unit ) ) ;
134
135
Writer . WL ( $@ "
135
136
public { _quantity . BaseType } { unit . PluralName } => As({ _unitEnumName } .{ unit . SingularName } );
136
137
" ) ;
@@ -158,6 +159,7 @@ private void GenerateStaticFactoryMethods()
158
159
/// Creates a <see cref=""{ _quantity . Name } ""/> from <see cref=""{ _unitEnumName } .{ unit . SingularName } ""/>.
159
160
/// </summary>
160
161
/// <exception cref=""ArgumentException"">If value is NaN or Infinity.</exception>" ) ;
162
+ Writer . WLIfText ( 2 , GetObsoleteAttributeOrNull ( unit ) ) ;
161
163
Writer . WL ( $@ "
162
164
public static { _quantity . Name } From{ unit . PluralName } ({ _quantity . BaseType } { valueParamName } ) => new { _quantity . Name } ({ valueParamName } , { _unitEnumName } .{ unit . SingularName } );
163
165
" ) ;
@@ -247,5 +249,18 @@ private void GenerateConversionMethods()
247
249
" ) ;
248
250
}
249
251
252
+ /// <inheritdoc cref="GetObsoleteAttributeOrNull(string)"/>
253
+ internal static string ? GetObsoleteAttributeOrNull ( Quantity quantity ) => GetObsoleteAttributeOrNull ( quantity . ObsoleteText ) ;
254
+
255
+ /// <inheritdoc cref="GetObsoleteAttributeOrNull(string)"/>
256
+ internal static string ? GetObsoleteAttributeOrNull ( Unit unit ) => GetObsoleteAttributeOrNull ( unit . ObsoleteText ) ;
257
+
258
+ /// <summary>
259
+ /// Returns the Obsolete attribute if ObsoleteText has been defined on the JSON input - otherwise returns empty string
260
+ /// It is up to the consumer to wrap any padding/new lines in order to keep to correct indentation formats
261
+ /// </summary>
262
+ private static string ? GetObsoleteAttributeOrNull ( string obsoleteText ) => string . IsNullOrWhiteSpace ( obsoleteText )
263
+ ? null
264
+ : $ "[Obsolete(\" { obsoleteText } \" )]";
250
265
}
251
266
}
You can’t perform that action at this time.
0 commit comments