Questions tagged [namevaluecollection]

NameValueCollection is a .Net collection of string keys and string values that can be accessed either with by key or by the index.

NameValueCollection is a .Net collection of string keys and string values that can be accessed either with by key or by the index.

References

116 questions
2
votes
1 answer

Regex Help, Parse into NameValueCollection

I'm having an issue with RegEx. I receive a string that needs to be parsed into a NameValueCollection. ParseQueryString doesn't work because (1) the string is space delimited and (2) the values can contain spaces. I have no control over the…
Greg
  • 119
  • 1
  • 10
2
votes
2 answers

Two decimal float changing to many decimals in cell

I have a value in a NameValueCollection that is .22. That value is loaded into a float fValue. The value is fValue=0.22 in debug, when it is written into Excel. InvoiceWs.Cells["I" + iRow.ToString()].Style.Numberformat.Format = "$#,##0.00"; fValue…
MatthewD
  • 6,719
  • 5
  • 22
  • 41
2
votes
1 answer

How to convert NameValueCollection to XML?

How can I convert a NameValueCollection like: var mydata = new NameValueCollection(); mydata.Add("UserID", "3698521478963"); mydata.Add("Password", "23584"); mydata.Add("VerifyCode", "23654"); to a XML String like this : XML Data: …
Sajjad Sarkoobi
  • 827
  • 8
  • 18
2
votes
1 answer

Convert HttpCookieCollection to NameValueCollection

My objective is to store all request(*QueryString,Form,Headers,Cookies*) information to a single NameValueCollection. Here is my code so far var mainNVC = new NameValueCollection(); mainNVC.Add(context.Request.Form);…
tangol100
  • 21
  • 4
2
votes
1 answer

Write to a NameValueCollection

I am trying to implement a simple construct where I first clear the NameValueCollection and the write new values to it. However at the moment I can't because it is read only. Is there a way to make it not read only or a walk around? My…
Ben
  • 2,518
  • 4
  • 18
  • 31
2
votes
1 answer

What happens behind the scenes during deserialization of a NameValueCollection?

What's going on behind the scenes in .NET (de)serialization that makes it behave the way it does in the following scenario? (This is a test app that just illustrates my setup.) I have a class with a NameValueCollection…
Adam Lear
  • 38,111
  • 12
  • 81
  • 101
2
votes
3 answers

Insert into NameValueCollection in .NET

Is it possible to insert an item into a NameValueCollection in a specific index? I don't see an Insert() method.
Mike Cole
  • 14,474
  • 28
  • 114
  • 194
2
votes
2 answers

How can I use a LINQ projection with List to get a NameValueCollection?

I have a var list = new List(); I want to extract MyStructure.Foo and MyStructure.Bar and put these two in a NameValueCollection. I want NameValueCollection because I am using WebClient.UploadValues() The following creates an…
Sam Leach
  • 12,746
  • 9
  • 45
  • 73
2
votes
0 answers

How to make HttpRequest object case-sensitive

I am working on asp .net web project, In which i am stuck in architectural issue. I having two Request parameters with same key but they are Case sensitive. Param names => reportDate and ReportDate As we know Request object internally implements…
Pavan Tiwari
  • 3,077
  • 3
  • 31
  • 71
1
vote
2 answers

Sorting a NameValueCollection by value in c#

I have a NameValueCollection and I would like to sort this on his value. Does anyone got some ideas how to do this easely? I was thinking to wrap it into a SortedList or SortedDictionairy but I'm not sure how to get started. Thijs
Thijs
  • 3,015
  • 4
  • 29
  • 54
1
vote
0 answers

Static Objects | Custom ConfigurationManager for Environment Independent Web.config

I am working on a typical .net web app which is first deployed at test environment - ENV- T and then after complete testing it is moved to Production ENV - P. Our hosting provider will not deploy anything directly on Prod instead it is first…
Gaurav
  • 840
  • 4
  • 16
1
vote
1 answer

Serializing NameValueCollection as Dictionary using System.Text.Json

I'm sure there's a converter I need to implement to handle NameValueCollection objects using System.Text.Json (note: I've seen the answers related to legacy JavaScriptSerializer). This: NameValueCollection nvc = new…
joelc
  • 2,687
  • 5
  • 40
  • 60
1
vote
0 answers

How to deserialize a binary-serialized NameValueCollection in .NET Core?

We have an existing SQL Server database with a field that contains binary-serialized instances of NameValueCollection. The serialization was done using C# code based on .NET Framework (where NameValueCollection was marked as [Serializable]). Our…
oclipa
  • 382
  • 2
  • 12
1
vote
4 answers

Populate array of objects from namevaluecollection in c#

I am new to C#. Here is a hard-coded thing I got working: InputProperty grantNumber = new InputProperty(); grantNumber.Name = "udf:Grant Number"; grantNumber.Val = "571-1238"; Update update = new Update(); update.Items = new InputProperty[] {…
John Adams
  • 4,773
  • 25
  • 91
  • 131
1
vote
0 answers

Unexpected results reading a C# List of NameValueCollections

I add three NameValueCollections to a List of NameValueCollections. When I read the NameValueCollections records back from the List and retrieve the values, I expect to see the three different values but instead each of the three returns the value…
WorkerBee
  • 19
  • 1