c# - How to use multi properties in class that contain one variable? -


If you help me, I would be very grateful I have a class called "config", whose name is called "param" The string variable is.

I would sometimes go to the "Config" class "Ultimate" variable as a type of typing form in the form of a type or string.

As I have understood that I need to create 3 properties in config class, each property must be converted as type,

The first property string is int Converts the second string into a boole, the third asset gives me string value.

The square should look something like this:

  class configuration {private string paragraph; Public Entry ParamasIant ({Return Intern. Purse (Ultimate)}}} Public Child Paramasubool {Return Bowl. Paras (Ultimate);}} Public String ParametestString {get {return param;}}}   < P> But I do not know how to use these qualities according to the qualities, which I want to go out of class.  

I hope you help me !! Thanks in advance!

This code will not be compiled - int and such are reserved keywords and can not be used as identifiers. You can either use your properties as something like Int32Value , StringValue etc. Try to give the name or try:

  Public stable underlying operator Bull {configuration} {return bool.Parse (config.param);} The public fixed underlying operator int ( Configuration config) {return int.Parse (config.param);}   

This is very clean code allowed Will:

  Config c = GetConfig ( "foo"); Var isFeatureEnabled = false || C; Var spacing = 23 + GetConfig ("bar");    

Comments