winrt简单克隆对象

public MapPoint Copy()//MapPoint克隆方法
        {
            MapPoint p = new MapPoint();//这是我自定义的对象
            //利用反射获得类成员
            FieldInfo[] fieldFroms = IntrospectionExtensions.GetTypeInfo(p.GetType()).DeclaredFields.ToArray();
            FieldInfo[] fieldTos = IntrospectionExtensions.GetTypeInfo(this.GetType()).DeclaredFields.ToArray();
            int lenTo = fieldTos.Length;

            for (int i = 0, l = fieldFroms.Length; i < l; i++)
            {
                for (int j = 0; j < lenTo; j++)
                {
                    if (fieldTos[j].Name != fieldFroms[i].Name) continue;
                    fieldTos[j].SetValue(p, fieldFroms[i].GetValue(this));
            break; } }
return p; }

 

winrt简单克隆对象

上一篇:Ubuntu 12.04+DarwinStreamingSrvr6.0.3 架设流媒体服务器


下一篇:kindeditor上传图片时候,上传成功了,但是页面上却提示失败