Base: Add ToURLQueryString function for dictionay

This commit is contained in:
Jonathan Jenne 2023-06-26 16:32:43 +02:00
parent c5b6498f1b
commit e5b5c259d7
2 changed files with 17 additions and 0 deletions

View File

@ -57,6 +57,7 @@
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Transactions" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />

View File

@ -1,4 +1,5 @@
Imports System.Runtime.CompilerServices
Imports System.Web
Public Module ModuleExtensions
Const UnixEraStartTicks As Long = 621355968000000000
@ -55,6 +56,21 @@ Public Module ModuleExtensions
Return (pString.Trim().ToLower() = "true") OrElse (pString.Trim() = "1")
End Function
' ======================================================
' === DICTIONARY
' ======================================================
<Extension()>
Public Function ToURLQueryString(pDictionary As IDictionary(Of String, String)) As String
Dim oQueryString = HttpUtility.ParseQueryString(String.Empty)
For Each oItem As KeyValuePair(Of String, String) In pDictionary
oQueryString.Add(oItem.Key, oItem.Value)
Next
Return oQueryString.ToString()
End Function
' ======================================================
' === DATATABLE
' ======================================================