kinect - How to clone an unserializable object? (C#) -


i working kinect windows version 2 , meet problem. try serialize body object , send through internet. body object not sterilisable. although can extract key information body object , create own object, may lose information. question how clone information body object own serializable object? thank you.

if cloning you're concerned with, use automapper.

first you'll need install automapper using nuget...

pm> install-package automapper 

then check out example , adapt own needs...

void main() {     automapper.mapper.createmap<user, myuser>()         .formember(myusers => myusers.name, users => users.mapfrom(property => string.format("{0} {1}",property.firstname, property.lastname)));      user user = new user     {         firstname = "james",         lastname = "doe",         dateofbirth = datetime.utcnow     };       myuser myuser = automapper.mapper.map<myuser>(user); }  public class myuser {     public string id { get; set; }     public string name { get; set; }     public datetime dateofbirth { get; set; }  }  public class user  {     public user()     {         this.id = guid.newguid().tostring();     }     public string id { get; set; }     public string firstname { get; set; }     public string lastname { get; set; }     public datetime dateofbirth { get; set; } } 

in example above, automapper figures out can map id property of myuser , user class because they're named identically, needed create custom map map user.firstname , user.lastname myuser.name property.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -