c# - Constructor has 2 parameters but is invoked with 1 argument -
i have following class:
public class notifications { public static notifications instance = new notifications(); public notificationhubclient hub { get; set; } private notifications() { hub = notificationhubclient.createclientfromconnectionstring( "<conn string full access>", "<hub name>"); } }
i'm trying modify code pass dynamically values of connection string , name of hub constructor,i changed constructor this:
private notifications(string connectionstring,string hubname) {...}
the problem have instance
,as can notice it's calling constructor no parameters,i tried change didn't work:
public static notifications instance = new notifications( string connectionstring,string hubname);
what should make instance
call constructor , pass 2 parameters?
instance
doesn't have access parameter value - has provide value them!
so can following:
public static notifications instance = new notifications("<conn string full access>", "<hub name>");
Comments
Post a Comment