すべて、C#アプリケーションをローカライズしていて、設定を制御できるようになりました。私が使用しているのでPropertyGrid、オプションを提供するためにプロパティを使用しています。CategoryAttributeさまざまな言語で表示する必要がある「サーバーアクセス」用のものがあります-私は持っていました:
[CategoryAttribute("ServerAccess"),
ReadOnlyAttribute(false),
XmlElement,
DescriptionAttribute("Message about the Server Access Option.")]
public bool ShowSystemDatabases
{
get { return this.showSystemDatabases; }
set { this.showSystemDatabases = value; }
}
そして私はこれを次のように変更しようとしました:
[CategoryAttribute(ObjectStrings.SettingsServerAccess),
ReadOnlyAttribute(false),
XmlElement,
DescriptionAttribute(MessageStrings.SettingsShowSystemDatabaseInfo)]
public bool ShowSystemDatabases
{
get { return this.showSystemDatabases; }
set { this.showSystemDatabases = value; }
}
私のリソースファイルはどこObjectStringsにありますか('ObjectStrings.resx' et al。)。これはコンパイル時エラーをスローしています
An attribute argument must be a constant expression, typeof expression or array
creation expression of an attribute parameter type...
コンストラクターが。を期待している場合は、明らかに文字列を使用できませんconst string。stringいろいろな家の周りの方法を使ってからキャストしようとしましconst stringたが、すべて失敗しました。それは十分に単純な問題ですが...
この問題を回避する最も簡単な方法は何ですか?
御時間ありがとうございます。