は、このクラスを持っているので、列挙型は
public static string SET_STB_MEDIA_CTRL (MultimediaConstants type, MultimediaConstants action)
{
return Command.SET_STB_MEDIA_CTRL + "type:" + type + "action:" + action;
}
:
public static class MultimediaConstants
{
public const string VIDEO = "video";
public const string AUDIO = "audio";
public const string PHOTO = "photo";
public const string ALL = "all";
public const string BACKGROUND_MUSIC = "background_music";
public const string TV = "tv";
public const string ACTION_PLAY = "play";
}
ポイントは、私はこのような何かがしたいということであり、この方法の結果は次のようになります。
SET STB MEDIA CTRL type:tv action:play
メソッドの呼び出しは次のようになります。
SET_STB_MEDIA_CTRL (MultimediaConstants.TV, MultimediaConstants.ACTION_PLAY);
あなたは静的クラスのインスタンスを作成することはできませんので、あなたは – Sehnsucht
これらは列挙型をアレントメソッドの引数として、静的クラスのインスタンスを求めることはできません。これらはクラスです。クラスの代わりに 'enum'キーワードを使って列挙型を作成することができます。必要な値を使用することができます。 –
@Sehnsuchtだからこそ、彼はjavaのように、 'Enum of strings'を望んでいます。 –