Skip to content

Commit

Permalink
iformattable
Browse files Browse the repository at this point in the history
  • Loading branch information
ignatandrei committed Jul 13, 2024
1 parent 3cca522 commit 0a34c06
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/RSCG_IFormattable/InfoClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ internal class PropertyGet
{
internal string Name { get; private set; }
public bool AdmitNulls { get; private set; }
public bool ArrayOfIFormattable { get; private set; }
public bool AdmitIFormattable { get; private set; }

public PropertyGet(IPropertySymbol it)
{
this.Name = it.Name;

var gettype = it.GetMethod!.ReturnType;
AdmitNulls = gettype.IsReferenceType || gettype.Name.ToLower()=="string" || gettype.Name.ToLower() == "system.string";

AdmitIFormattable= gettype.Interfaces.Any(it => it.Name == "IFormattable");
}
}
1 change: 1 addition & 0 deletions src/RSCG_IFormattable/RazorGenerator.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ namespace @Model.nameSpace {
}
<text>
if(format.Contains("{@item.Name}")){
//TODO : if @item.AdmitIFormattable is true, use IFormattable
var val = @item.Name.ToString();
retValue=retValue.Replace("{@item.Name}", @val);
}
Expand Down

0 comments on commit 0a34c06

Please sign in to comment.