/// <Summary> /// Convert object /// </Summary> /// <Typeparam name = "T1"> Converted entity </Typeparam> /// <Typeparam name = "T2"> Converted entity </Typeparam> /// <Param name = "T1"> </param> /// <Param name = "T2"> </param> /// <Returns> </returns> Public T2 parstmodel <T1, T2> (T1 T1, T2 T2 ){ Try { If (T1 = Null ){ Return T2 ;} Else {System. reflection. propertyinfo [] Properties = T1.gettype (). getproperties (system. reflection. bindingflags. instance | System. reflection. bindingflags. Public ); If (Properties. Length <= 0 ){ Return T2 ;} Foreach (System. reflection. propertyinfo item In Properties ){ String Name = Item. Name; Object Value = item. getvalue (T1, Null ); If (Item. propertytype. isvaluetype | item. propertytype. Name. startswith ( " String " ) {T2.gettype (). getproperty (name). setvalue (t2, value, Null );} Else {Parstmodel (value, T2 );}}} Return T2 ;} Catch (Exception ex ){ Throw Ex ;}} /// <Summary> /// Convert string to array /// </Summary> /// <Param name = "str"> String object to be converted </Param> /// <Param name = "arr"> Returned String Array </Param> /// <Returns> </returns> Public String [] Strsplittoarry ( String STR, String [] ARR ){ If (Str. Contains ( ' , ' ) {Arr = Str. Split ( ' , ' );} Else {Array. Resize ( Ref Arr, 1 ); Arr [ 0 ] = STR ;} Return Arr ;}