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

C#

 
GeneralRe: Cheque Print source code Pin
omdotnet24-Sep-09 21:37
omdotnet24-Sep-09 21:37 
GeneralRe: Cheque Print source code Pin
Nader Rafiee1-Dec-09 23:47
Nader Rafiee1-Dec-09 23:47 
GeneralRe: Cheque Print source code Pin
comptax7-Mar-11 6:05
comptax7-Mar-11 6:05 
GeneralRe: Cheque Print Software - source code Pin
GNPrinting5-Apr-11 19:12
GNPrinting5-Apr-11 19:12 
GeneralRe: Cheque Print source code Pin
zuber ahmed17-May-14 3:14
zuber ahmed17-May-14 3:14 
QuestionLoading or creating a Application depending on different versions Pin
vijaylumar13-Sep-09 3:30
vijaylumar13-Sep-09 3:30 
AnswerRe: Loading or creating a Application depending on different versions Pin
Eddy Vluggen13-Sep-09 3:40
professionalEddy Vluggen13-Sep-09 3:40 
QuestionCopy Class to Another Class - Cast Problem Pin
dataminers13-Sep-09 3:12
dataminers13-Sep-09 3:12 
I have two class;

public class AkdPerson
{
public int PersonID { get; set; }
public string PersonName { get; set; }
}

public class XPOPerson
{
public int PersonID { get; set; }
public string PersonName { get; set; }
}

How can I deep copy AkdPerson to XPOPerson, and XPOPerson to AkdPerson.

Actually I write DeepCopy metod, like this;

public static T DeepCopy<T>(T obj)
{
object result = null;
using (var ms = new MemoryStream())
{
var formatter = new BinaryFormatter();
formatter.Serialize(ms, obj);
ms.Position = 0;
result = (T)formatter.Deserialize(ms);
ms.Close();
}
return (T)result;
}

But I can't conver to AkdPerson to XPOPerson.
I GET ERROR - IMPLICITY CONVERT
AkdPerson akdPerson = new AkdPerson();
akdPerson.PersonID = 1;
akdPerson.PersonName = "Joe";
XPOPerson xpoPerson = DeepCopy(akdPerson);
AnswerRe: Copy Class to Another Class - Cast Problem Pin
N a v a n e e t h13-Sep-09 3:25
N a v a n e e t h13-Sep-09 3:25 
GeneralRe: Copy Class to Another Class - Cast Problem Pin
dataminers13-Sep-09 3:50
dataminers13-Sep-09 3:50 
GeneralRe: Copy Class to Another Class - Cast Problem Pin
N a v a n e e t h13-Sep-09 17:49
N a v a n e e t h13-Sep-09 17:49 
GeneralRe: Copy Class to Another Class - Cast Problem Pin
dataminers14-Sep-09 23:33
dataminers14-Sep-09 23:33 
AnswerRe: Copy Class to Another Class - Cast Problem Pin
Eddy Vluggen13-Sep-09 3:42
professionalEddy Vluggen13-Sep-09 3:42 
GeneralRe: Copy Class to Another Class - Cast Problem Pin
dataminers13-Sep-09 3:51
dataminers13-Sep-09 3:51 
GeneralRe: Copy Class to Another Class - Cast Problem Pin
Eddy Vluggen13-Sep-09 3:54
professionalEddy Vluggen13-Sep-09 3:54 
GeneralRe: Copy Class to Another Class - Cast Problem Pin
dataminers13-Sep-09 4:01
dataminers13-Sep-09 4:01 
GeneralRe: Copy Class to Another Class - Cast Problem Pin
J4amieC13-Sep-09 4:53
J4amieC13-Sep-09 4:53 
AnswerRe: Copy Class to Another Class - Cast Problem Pin
J4amieC13-Sep-09 4:55
J4amieC13-Sep-09 4:55 
AnswerRe: Copy Class to Another Class - Cast Problem Pin
PIEBALDconsult13-Sep-09 5:10
mvePIEBALDconsult13-Sep-09 5:10 
QuestionThe remote certificate is invalid according to the validation procedure. Pin
khosnur13-Sep-09 2:17
khosnur13-Sep-09 2:17 
Questionpop3 secure mail download using C# Pin
khosnur13-Sep-09 0:51
khosnur13-Sep-09 0:51 
AnswerRe: pop3 secure mail download using C# Pin
Richard MacCutchan13-Sep-09 1:31
mveRichard MacCutchan13-Sep-09 1:31 
GeneralRe: pop3 secure mail download using C# Pin
khosnur13-Sep-09 2:22
khosnur13-Sep-09 2:22 
GeneralRe: pop3 secure mail download using C# Pin
Richard MacCutchan13-Sep-09 3:18
mveRichard MacCutchan13-Sep-09 3:18 
AnswerRe: pop3 secure mail download using C# Pin
dan!sh 13-Sep-09 1:42
professional dan!sh 13-Sep-09 1:42 

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.