问题描述
我收到有关使用string.Replace(string,string?)
而不是string.Replace(string,string?,System.StringComparison)
(我得到)的CA1307警告。但是,当我上一行添加(例如)StringComparison.OrdinalIgnoreCase
时,智能感知和编译都表示没有重载。 string.Contains()
也会发生相同的问题。
这是警告:
Services\TemplateManager.cs(16,14): warning CA1307: The behavior of 'string.Replace(string,string?)' Could vary based on the current user's locale settings. Replace this call in 'RSPlatform.Mail.Services.Template.Template(string,string,RSPlatform.Mail.TemplateType)' with a call to 'string.Replace(string,System.StringComparison)'. [C:\<path>\<projectName>.csproj]
下面是示例代码行:
content = content.Replace(CRLF,LSCRLF); // Insert LINE_SEParaTOR
仅提供两个重载-char和string变体(都不使用StringComparison参数)
当我使用F12方法时,字符串元数据也仅显示存储在我的计算机上的两个重载:
%USERPROFILE%\AppData\Local\Temp\MetadataAsSource\15ed471edd80488c83ca4e3630c3149e\a25468945e7847cd8450af15ed506852\String.cs
代码在具有以下.csproj的类库中:
<PropertyGroup>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<TargetFrameworks>net48;netcoreapp3.1;netstandard2.1</TargetFrameworks>
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
<SccProjectName>SAK</SccProjectName>
<ScclocalPath>SAK</ScclocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
任何指针将不胜感激。谢谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)