PayPal.Invoice.Model.OtherPaymentDetailsType.CreateInstance C# (CSharp) Метод

CreateInstance() публичный статический Метод

Factory method for creating new object instances. For use by the de-serialization classes only.
public static CreateInstance ( string>.Dictionary map, string prefix, int index ) : OtherPaymentDetailsType
map string>.Dictionary NVP map as returned by an API call
prefix string NVP prefix for this class in the response
index int For array elements, index of this element in the response
Результат OtherPaymentDetailsType
        public static OtherPaymentDetailsType CreateInstance(Dictionary<string, string> map, string prefix, int index)
        {
            OtherPaymentDetailsType otherPaymentDetailsType = null;
            string key;
            int i = 0;
            if(index != -1)
            {
                if (prefix.Length > 0 && !prefix.EndsWith("."))
                {
                    prefix = prefix + "(" + index + ").";
                }
            }
            else
            {
                if (prefix.Length > 0 && !prefix.EndsWith("."))
                {
                    prefix = prefix + ".";
                }
            }
            key = prefix + "method";
            if (map.ContainsKey(key))
            {
                otherPaymentDetailsType = (otherPaymentDetailsType == null) ? new OtherPaymentDetailsType() : otherPaymentDetailsType;
                otherPaymentDetailsType.method = (PaymentMethodsType)EnumUtils.GetValue(map[key],typeof(PaymentMethodsType));
            }
            key = prefix + "note";
            if (map.ContainsKey(key))
            {
                otherPaymentDetailsType = (otherPaymentDetailsType == null) ? new OtherPaymentDetailsType() : otherPaymentDetailsType;
                otherPaymentDetailsType.note = map[key];
            }
            key = prefix + "date";
            if (map.ContainsKey(key))
            {
                otherPaymentDetailsType = (otherPaymentDetailsType == null) ? new OtherPaymentDetailsType() : otherPaymentDetailsType;
                otherPaymentDetailsType.date = map[key];
            }
            key = prefix + "amount";
            if (map.ContainsKey(key))
            {
                otherPaymentDetailsType = (otherPaymentDetailsType == null) ? new OtherPaymentDetailsType() : otherPaymentDetailsType;
                otherPaymentDetailsType.amount = System.Convert.ToDecimal(map[key], DefaultCulture);
            }
            return otherPaymentDetailsType;
        }