Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4840

Blazor Injection of a helper class to other classes

$
0
0

this is using Blazor c#/html.

im taking a helper class:

    public class HelperClass    {        public bool HelperClassBoolF { get; set; }        public bool HelperClassBoolT { get; set; }        public HelperClass()        {            HelperClassBoolF = false;            HelperClassBoolT = true;        }    }

and wanting to set the variable in PrintShopAttachment.cs, then have it use it in Attachment.cs

in startup.cs i am using

services.AddSingleton<HelperClass>();

classes do not allow injection, the @sign doesn't allow any sort of auto fill. how can classes share a global variables. i was wanting the helper class usable in both PrintShopAttachment.cs and Attachment.cs.


Viewing all articles
Browse latest Browse all 4840

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>