Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Discussions

Adam Speight Adam​Speight2008 The Bandito Coder
  • How do you solve this C# task with least amount of work?

    androidi,  I don't know if this meets your requirements but it can extract the public fields of any object to a XML structure. The method Produce(Of T) does the reverse takes that XML structure and produces an Object of the type provide in the generic parameter.

    Option Infer on
    Imports System.Runtime.CompilerServices
     
    Module Module1
    Sub Main()
    Dim x As New Example
    Dim rx =x.GetPublicFields.XMLified_PublicFields(x)
    Dim m = <Fields>
    <Field Name="AA" Type="System.String" Value="Adam" /> 
    <Field Name="B" Type="System.String" Value="Bananas" /> 
    <Field Name="C" Type="System.Double" Value="2.4" /> 
    </Fields>
    Dim p = m.Produce(Of Example)
    End Sub
    
      <Extension>
    Public Function Produce(Of T) (x As Xml.Linq.XElement) As T
    Dim TObj as T = GetType(T).GetConstructor({}).Invoke({})
    For Each f In x.<Field>
    Dim TheField = TObj.GetType.GetField(f.@Name)
    If (TheField Is Nothing) OrElse (TheField.FieldType.ToString <> f.@Type) Then Continue For
    TheField.SetValue( TObj, Convert.ChangeType(f.@Value,Type.GetType(f.@Type)))
    Next
    Return TObj 
    End Function
     
     
    <Extension>
    public Function GetPublicFields(Of T)(obj As T) As IEnumerable(OF Reflection.FieldInfo)
    Return From f in obj.GetType.GetFields Where f.IsPublic 
    End Function
     
     
    <Extension>
    Public Function XMLified_PublicFields(Of T)( fields As IEnumerable(of Reflection.FieldInfo),obj As T) As Xml.Linq.XElement 
    Return _
    <Fields>
    <%= From f In fields Select <Field Name= <%= f.Name %> Type=<%= f.FieldType %> Value= <%= f.GetValue(obj) %>/>%>
    </Fields> 
    End Function
     
     
    End Module
     
    Public Class Example
    Public A As String ="A"
    Public B As String = "B"
    Public C As Double = 1.1
    End Class
    

  • Visual Studio is getting out of control

    Separate folder structure permits side-by-side loading of different versions of VS.

    Makes it a lot easier to uninstall them.

  • Spamalot

    Can I suggest we let them spam away but on a newly spawned instance of the forum only they can interact. with.

    Wastes their time, whilst collecting evidence and information which then can be use as learning data for the forum software so it can automatically spawn, or suspicion of spam..

    The Mods can always change which instance of the forum you see.

  • I've been assimilated!

    He's the Guy in Nine Guy costume now.

  • Why does IE10 break Cleartype for us Desktop users???

    @JoshRoss:So you not heard that you can purchase polished turds.

  • How can I combine 2 ​Observable​Collections side by side?

    What about using zip.

    col_A.Zip(col_B, Function(a,b) {a,b})

    or using RX?

  • True hope!!!​!!!!!!

    Why not just urinate into a telsa turbine generator. After a night on the pop, that first whizz of the morning could power my laptop for a week. 

  • Thoughts on NuGet?

    Why do a lot people of assume NuGet is just for Visual Studio and programming?

    It's a Package Manager, there's nothing stop you using it for Managing Packages of other things. Say documentation auto-magically have up-to-date documentation. Eg Company Policies / Health & Safety Docs or Issuing of Comics. 

    Distribution of game levels.  

  • Windows 8 Surface versus Apple

    @spivonious

    What about a new XBox?

    XBox Mobile (Sony Vita)?

    This would be insanely cool, a mobile phone capable of playing current XBox games.

    HD Kinect? Enough for precision Finger joint recognition and facial expression recognition

    Imagine a shoot-em-up where your guns are your hands.

    For accessibility imagine someone using Skype where their signing is automatic "translated" into text / speech. And the other callers speech is translate into text / signing.

     

  • Sticky Language

    @spivonious: Not End as that just ends the program, but any of the following I'm fine with.

    End If
    End While
    End Select
    End With 
    End Function
    End Sub
    End Class
    End Structure
    End Interface
    End Module
    End Event
    End AddHandler
    End RemoveHandler
    End RaiseEvent
    End Get
    End Set
    End Property
    End SyncLock
    End Try
    End Namespace
    End Operator
    End Using
    End Enum
    #End Region
    #End ExternalSource

    I think that's all of them.