Avatar of rwheeler23
rwheeler23
Flag for United States of America asked on

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?
C#

Avatar of undefined
Last Comment
rwheeler23

8/22/2022 - Mon
p_davis

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.
ASKER CERTIFIED SOLUTION
AndyAinscow

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
p_davis

shoot, didn't see the static
SOLUTION
kaufmed

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
AndyAinscow

Yes, but as the current code didn't work it implies it is outside the class
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
rwheeler23

ASKER
Thanks