Skip to content

Instantly share code, notes, and snippets.

@kristoferdoman
Last active August 26, 2016 18:40
Show Gist options
  • Select an option

  • Save kristoferdoman/8d48497b6fa890c89de7 to your computer and use it in GitHub Desktop.

Select an option

Save kristoferdoman/8d48497b6fa890c89de7 to your computer and use it in GitHub Desktop.

Revisions

  1. kristoferdoman renamed this gist Aug 26, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. kristoferdoman renamed this gist Aug 26, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. kristoferdoman revised this gist Apr 6, 2016. No changes.
  4. kristoferdoman revised this gist Apr 6, 2016. 2 changed files with 14 additions and 14 deletions.
    14 changes: 0 additions & 14 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,14 +0,0 @@
    Public Function ToDictionary() As Dictionary(Of String, Object)
    Dim dictionary As Dictionary(Of String, Object) = New Dictionary(Of String, Object)

    For Each property_info As Reflection.PropertyInfo In [GetType].GetProperties()
    Try
    Console.WriteLine("name: " + property_info.Name + " value: " + property_info.GetValue(Me, Nothing).ToString)
    dictionary.Add(property_info.Name, property_info.GetValue(Me, Nothing).ToString)
    Catch ex As Exception
    dictionary.Add(property_info.Name, ex.Message)
    End Try
    Next

    Return dictionary
    End Function
    14 changes: 14 additions & 0 deletions object-to-dictionary.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    Public Function ToDictionary() As Dictionary(Of String, Object)
    Dim dictionary As Dictionary(Of String, Object) = New Dictionary(Of String, Object)

    For Each property_info As Reflection.PropertyInfo In [GetType].GetProperties()
    Try
    Console.WriteLine("name: " + property_info.Name + " value: " + property_info.GetValue(Me, Nothing).ToString)
    dictionary.Add(property_info.Name, property_info.GetValue(Me, Nothing).ToString)
    Catch ex As Exception
    dictionary.Add(property_info.Name, ex.Message)
    End Try
    Next

    Return dictionary
    End Function
  5. kristoferdoman revised this gist Aug 19, 2015. No changes.
  6. kristoferdoman created this gist Aug 19, 2015.
    14 changes: 14 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    Public Function ToDictionary() As Dictionary(Of String, Object)
    Dim dictionary As Dictionary(Of String, Object) = New Dictionary(Of String, Object)

    For Each property_info As Reflection.PropertyInfo In [GetType].GetProperties()
    Try
    Console.WriteLine("name: " + property_info.Name + " value: " + property_info.GetValue(Me, Nothing).ToString)
    dictionary.Add(property_info.Name, property_info.GetValue(Me, Nothing).ToString)
    Catch ex As Exception
    dictionary.Add(property_info.Name, ex.Message)
    End Try
    Next

    Return dictionary
    End Function