How do I get and set Environment variables in C#?
How can I get Environnment variables and if something is missing, set the value? 9 Answers 9
How can I get Environnment variables and if something is missing, set the value? 9 Answers 9
I am trying to build a pie chart from a dictionary. Before I display the pie chart, I want to tidy up the data. I’m removing any pie slices that would be less than 5% of the pie and putting them in a “Other” pie slice. However I’m getting a Collection was modified; enumeration operation … Read more
I am getting the following error when I post back a page from the client-side. I have JavaScript code that modifies an asp:ListBox on the client side. How do we fix this? Error details below: Server Error in ‘/XXX’ Application. ——————————————————————————– Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation=”true”/> in configuration … Read more
In a .NET 2.0 C# application I use the following code to detect the operating system platform: string os_platform = System.Environment.OSVersion.Platform.ToString(); This returns “Win32NT”. The problem is that it returns “Win32NT” even when running on Windows Vista 64-bit. Is there any other method to know the correct platform (32 or 64 bit)? Note that it should also … Read more
I need to search a string and replace all occurrences of %FirstName% and %PolicyAmount% with a value pulled from a database. The problem is the capitalization of FirstName varies. That prevents me from using the String.Replace() method. I’ve seen web pages on the subject that suggest Regex.Replace(strInput, strToken, strReplaceWith, RegexOptions.IgnoreCase); However for some reason when … Read more
Using C# .NET 2.0, I have a composite data class that does have the [Serializable] attribute on it. I am creating an XMLSerializer class and passing that into the constructor: XmlSerializer serializer = new XmlSerializer(typeof(DataClass)); I am getting an exception saying: There was an error reflecting type. Inside the data class there is another composite … Read more