Home > Net >  C # string array can be encapsulated into attribute?
C # string array can be encapsulated into attribute?

Time:09-18

String [] mf3={" c ", "c + +", "c #"};
There is a fixed value of array, I'd like to encapsulate into an attribute that can pass the subscript, export the corresponding string, how should do? Baidu once, attribute cannot take parameters, index encapsulation method, can't be such an array, is such an array, can only be expressed in an array in c #?

Purpose is to solve every module in the project need to call to the string, as long as the program start don't need to change, only need to read it,

CodePudding user response:

Enumeration can't satisfy you?

CodePudding user response:

 
Public string [] Mf3 {get {return Mf3. } the set {mf3=value; }}

This??????

CodePudding user response:

Enumeration, array, this is not a static variables can be
  •  Tags:  
  • C #
  • Related