My static String in library project becomes null when i enter a controller in API project
Hello so i have two projects. A library project(where you define models and call API Controllers) and API project. In library project , i defined a static class with static string and string is not null. but i am having a problem when i call a controller this string becomes null and when i exit the controller , it returns to its ordinary value. Does someone know how or why? Thanks in advance
5 Replies
Does the string get reassigned at any point maybe?
Why not make it a
const
, that will stop that from happeningno it doesnt only once
Or store it in the config file and read from there instead
Variables, generally, don't just change value spontaneously
So something fucky-wucky is going on
Try using a
const
and see if it still happenswill do
ok turns out i cant do that because im binding the variable in another library(and i cant change that) lol
but i tried doing that and it worked
If there's a binding to that variable, it could be that that's what changes it
You could do something like
and bind to
MyStr
maybe