Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ASP.NET C# Bool type casting
- bool status1 = (bool)Cache["cache_req_head"];
- bool status2 = (bool)Cache["cache_super"];
- bool status3 = (bool)Cache["cache_head"];
- if (checkreqhead == true)
- {
- Cache["cache_req_head"] = true;
- }
- else if (checksuper == true)
- {
- Cache["cache_super"] = true;
- }
- else if (checkhead == true)
- {
- Cache["cache_head"] = true;
- }
- bool status1 = (bool)Cache["cache_req_head"];
- bool status1 = false;
- if (Cache["cache_req_head"] != null)
- {
- status1 = (bool)Cache["cache_req_head"];
- }
- bool? status1 = (bool?)Cache["cache_req_head"];
- //string is used as an example; you should put the type you expect
- string variable = Cache["KEY"] as string;
- if(variable!=null)
- {
- // do something
- }
Add Comment
Please, Sign In to add comment