.net - Convert string to current culture in c# -
i have instance of "windows firewall" windows service, using
servicecontroller service = new servicecontroller("windows firewall");
this works fine in en-us culture, when try in windows portuguese(brazil) pt-pt culture, throws exception service not found.
yes, in portuguese there no "windows firewall" instead "firewall windows", if change code below
servicecontroller service = new servicecontroller("firewall windows");
it work in pt-pt culture.
is there generic way, "windows firewall" instance irrespective of culture?
there's no system provided function perform such conversion. you'd have create list/dictionary of possible values in own code, , value.
Comments
Post a Comment