How to assign value to class member C#

I have defined this member in my Model class as such:

        public static bool StackTraceWanted { get; private set; }

I know what to assign it the value of true or false in another portion of the code

            Model.StackTraceWanted = true;

This does not work. How to I assign it a value?
LVL 1
rwheeler23Asked:
Who is Participating?
 
AndyAinscowFreelance programmer / ConsultantCommented:
You have explicitly coded it so it is impossible to set the value from somewhere else.  Change your code to
 public static bool StackTraceWanted { get; set; }
0
 
p_davisCommented:
you can only assign a value in the Model class itself and would just reference it as StackTraceWanted not Model.StackTraceWanted.

if you want to be able to assign out side of the model class then take away the private key word in the setter.
0
 
p_davisCommented:
shoot, didn't see the static
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
käµfm³d 👽Commented:
You have explicitly coded it so it is impossible to set the value from somewhere else.
Somewhere outside the class, that is.
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
Yes, but as the current code didn't work it implies it is outside the class
0
 
rwheeler23Author Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.