當前位置: 首頁>>代碼示例>>C#>>正文


C# UInt64.Equals方法代碼示例

本文整理匯總了C#中System.UInt64.Equals方法的典型用法代碼示例。如果您正苦於以下問題:C# UInt64.Equals方法的具體用法?C# UInt64.Equals怎麽用?C# UInt64.Equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.UInt64的用法示例。


在下文中一共展示了UInt64.Equals方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: addEcommerceItem

        /// <summary>
        /// Adds an item in the Ecommerce order.
        /// 
        /// This should be called before doTrackEcommerceOrder(), or before doTrackEcommerceCartUpdate().
        /// This function can be called for all individual products in the cart (or order).
        /// SKU parameter is mandatory. Other parameters are optional (set to false if value not known).
        /// Ecommerce items added via this function are automatically cleared when doTrackEcommerceOrder() or getUrlTrackEcommerceOrder() is called.
        /// </summary>       
        /// <param name="sku">SKU, Product identifier </param> 
        /// <param name="name">Product name</param> 
        /// <param name="category">Product category</param> 
        /// <param name="price"> Individual product price (supports integer and decimal prices)</param> 
        /// <param name="quantity">Product quantity. If not specified, will default to 1 in the Reports</param> 
        public void addEcommerceItem(string sku, string name = null, string category = null, double price = Double.MinValue, UInt64 quantity = UInt64.MinValue)
        {
            if(String.IsNullOrEmpty(sku))
            {
                throw new Exception("You must specify a SKU for the Ecommerce item");
            }

            string sanitizedName = name;
            if (name == null)
            {
                sanitizedName = "false";
            }

            string sanitizedCategory = category;
            if (category == null)
            {
                sanitizedCategory = "false";
            }

            string priceString = formatMonetaryValue(price);
            if (price.Equals(Double.MinValue))
            {
                priceString = "false";
            }

            string quantityString = quantity.ToString();
            if (quantity.Equals(UInt64.MinValue))
            {
                quantityString = "false";
            }

            string[] eCommerceItem = { sku, sanitizedName, sanitizedCategory, priceString, quantityString };

            ecommerceItems.Remove(sku);
            ecommerceItems.Add(sku, eCommerceItem);
        }
開發者ID:HarleyCarter1234,項目名稱:piwik-dotnet-tracker,代碼行數:49,代碼來源:PiwikTracker.cs


注:本文中的System.UInt64.Equals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。