Options for migration of string comparisons (helper method?)
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
調査の方向性
この issue では、具体的なファイル、テスト、エントリポイントは指定されていません。まず CodeConverter のソースで Option Compare Text が CultureInfo.CurrentCulture.CompareInfo.Compare に変換される流れを追跡し、次に比較結果をヘルパーメソッドによって設定または表現できるかどうかを判断してください。合意されたアプローチと、それに伴う実装範囲が決まれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Perhaps this should not be an issue or a feature request but I think it's worthy of discussion, and we can always delete later if needed.
I'm about to Migrate perhaps 50k to 100k lines of code from VB to C#. Almost all of it has Option Compare Text.
Now when we migrate, code like this
If kv.Key = sVariableName Then
It gets converted to this:
if (CultureInfo.CurrentCulture.CompareInfo.Compare(kv.Key ?? "", sVariableName ?? "", CompareOptions.IgnoreCase | CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth) == 0)
I'm sure I'm not the only one who doesn't want to live with that kind of code going forward, especially in a large project.
Ideally I would like improve the syntactic elegance using something like an Extension method
[Extension]
public static bool EqualsIgnoreCase(this string str1, string str2)
{
return string.Equals(str1 ?? "", str2 ?? "", StringComparison.OrdinalIgnoreCase);
}
Then the migrated c# would be
if (kv.Key.EqualsIgnoreCase(sVariableName)) {
I would have liked to overload the string == operator but that doesn't sound possible.
So, before I start digging in the CodeConverter source code for how to implement this, are there any other options or ways to influence the conversion as above, and does anyone else feel that there would be value in changing the code if appropriate for something like the above ?
- 主要言語
- C#
- スター
- 913
- フォーク
- 244
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
icsharpcode/CodeConverter のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
icsharpcode/CodeConverter#1271 · コメント 1 件 ·
-
C# -> VB
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
icsharpcode/CodeConverter#1281 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
icsharpcode/CodeConverter#1275 ·
-
VB -> C#
難易度 3/5 1〜2日 初心者へのやさしさ 62/100
icsharpcode/CodeConverter#1273 ·
-
VB -> C#: "Group By Into" Linq queries supressing aggregations ("Into" part) in the converted codeオープンDifficult area VB -> C#
難易度 3/5 1〜2日 初心者へのやさしさ 74/100
icsharpcode/CodeConverter#1272 ·
icsharpcode/CodeConverter の issue をすべて見る
似ている issue
-
area-ai untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
dotnet/extensions#7790 ·
メンテナーはふだん 1 日以内に返信
-
P2 testing
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
メンテナーはふだん 1 日以内に返信
-
area-Infrastructure-coreclr os-ios os-maccatalyst os-tvos untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
dotnet/runtime#134766 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
0 - Backlog Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
BrighterCommand/Brighter#4444 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信