Click here to Skip to main content
15,905,322 members
Home / Discussions / C#
   

C#

 
AnswerRe: Click Once Publishing Pin
Łukasz Nowakowski6-Aug-10 1:55
Łukasz Nowakowski6-Aug-10 1:55 
GeneralRe: Click Once Publishing Pin
lourensG6-Aug-10 2:06
lourensG6-Aug-10 2:06 
GeneralRe: Click Once Publishing Pin
Łukasz Nowakowski6-Aug-10 2:07
Łukasz Nowakowski6-Aug-10 2:07 
GeneralRe: Click Once Publishing Pin
lourensG6-Aug-10 2:15
lourensG6-Aug-10 2:15 
GeneralRe: Click Once Publishing Pin
Łukasz Nowakowski6-Aug-10 2:19
Łukasz Nowakowski6-Aug-10 2:19 
GeneralRe: Click Once Publishing Pin
lourensG6-Aug-10 3:09
lourensG6-Aug-10 3:09 
GeneralRe: Click Once Publishing Pin
Łukasz Nowakowski6-Aug-10 3:11
Łukasz Nowakowski6-Aug-10 3:11 
QuestionSalary calculation Pin
nufail6-Aug-10 0:46
nufail6-Aug-10 0:46 
AnswerRe: Salary calculation Pin
Sauro Viti6-Aug-10 0:48
professionalSauro Viti6-Aug-10 0:48 
AnswerRe: Salary calculation Pin
Pete O'Hanlon6-Aug-10 1:01
mvePete O'Hanlon6-Aug-10 1:01 
AnswerRe: Salary calculation Pin
Abhinav S6-Aug-10 1:22
Abhinav S6-Aug-10 1:22 
AnswerRe: Salary calculation Pin
PIEBALDconsult6-Aug-10 3:10
mvePIEBALDconsult6-Aug-10 3:10 
GeneralRe: Salary calculation Pin
JHizzle6-Aug-10 4:34
JHizzle6-Aug-10 4:34 
GeneralRe: Salary calculation Pin
PIEBALDconsult6-Aug-10 14:31
mvePIEBALDconsult6-Aug-10 14:31 
QuestionStatusBar Color Change ???? Pin
Krishna Varadharajan5-Aug-10 20:48
Krishna Varadharajan5-Aug-10 20:48 
AnswerRe: StatusBar Color Change ???? Pin
Rajesh Anuhya5-Aug-10 21:03
professionalRajesh Anuhya5-Aug-10 21:03 
QuestionIs there any technique available for copying one object of class A to another object of class B ? Pin
Nadia Monalisa5-Aug-10 14:26
Nadia Monalisa5-Aug-10 14:26 
AnswerRe: Is there any technique available for copying one object of class A to another object of class B ? [modified] Pin
nlarson115-Aug-10 14:57
nlarson115-Aug-10 14:57 
GeneralRe: Is there any technique available for copying one object of class A to another object of class B ? Pin
Nadia Monalisa5-Aug-10 15:14
Nadia Monalisa5-Aug-10 15:14 
GeneralRe: Is there any technique available for copying one object of class A to another object of class B ? Pin
nlarson115-Aug-10 16:18
nlarson115-Aug-10 16:18 
GeneralRe: Is there any technique available for copying one object of class A to another object of class B ? Pin
Nadia Monalisa5-Aug-10 16:22
Nadia Monalisa5-Aug-10 16:22 
GeneralRe: Is there any technique available for copying one object of class A to another object of class B ? Pin
nlarson115-Aug-10 16:50
nlarson115-Aug-10 16:50 
Forgive...i'm a lowly VB programmer and i just quickly threw this together - so translate it and it should do what your looking for

Imports System.Reflection

Public Class Form1
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim a As New TheFromClass With {.Hello = "hello there", .Name = "myclass"}
        Dim b As New TheToClass With {.GoodBye = "later dude", .Hello = "wuzup"}

        Dim ta As Type = GetType(TheFromClass)
        Dim tb As Type = GetType(TheToClass)

        Dim obj As Object, PropertyName As String, ToPI As PropertyInfo = Nothing

        MsgBox(b.Hello)

        For Each FromPI As PropertyInfo In ta.GetProperties
            PropertyName = FromPI.Name
            obj = FromPI.GetValue(a, Nothing)

            ToPI = tb.GetProperties.Where(Function(p) p.Name = PropertyName).FirstOrDefault

            If ToPI IsNot Nothing Then ToPI.SetValue(b, obj, Nothing)
        Next

        MsgBox(b.Hello)

        End
    End Sub
End Class

Public Class TheFromClass
    Public Property Hello As String
    Public Property Name As String
End Class

Public Class TheToClass
    Public Property GoodBye As String
    Public Property Hello As String
End Class

'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous

GeneralRe: Is there any technique available for copying one object of class A to another object of class B ? Pin
Nadia Monalisa5-Aug-10 16:58
Nadia Monalisa5-Aug-10 16:58 
AnswerRe: Is there any technique available for copying one object of class A to another object of class B ? Pin
Giorgi Dalakishvili5-Aug-10 20:27
mentorGiorgi Dalakishvili5-Aug-10 20:27 
AnswerRe: Is there any technique available for copying one object of class A to another object of class B ? PinPopular
Bernhard Hiller5-Aug-10 20:33
Bernhard Hiller5-Aug-10 20:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.