本文整理汇总了C#中Dictionary.Update方法的典型用法代码示例。如果您正苦于以下问题:C# Dictionary.Update方法的具体用法?C# Dictionary.Update怎么用?C# Dictionary.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dictionary
的用法示例。
在下文中一共展示了Dictionary.Update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CancelFeedSubmissions
public TreeWrapper CancelFeedSubmissions(string[] feedIds=null, string[] feedTypes=null,
string fromDate=null, string toDate=null)
{
var data = new Dictionary<string, string>() {
{"Action", "CancelFeedSubmissions"},
{"SubmittedFromDate", fromDate},
{"SubmittedToDate", toDate}
};
data.Update(EnumerateParam("FeedSubmissionIdList.Id.", feedIds));
data.Update(EnumerateParam("FeedTypeList.Type.", feedTypes));
return MakeRequest(data);
}
示例2: GetFeedSubmissionCount
public TreeWrapper GetFeedSubmissionCount(string[] feedTypes=null, string[] processingStatuses=null,
string fromDate=null, string toDate=null)
{
var data = new Dictionary<string, string>() {
{"Action", "GetFeedSubmissionCount"},
{"SubmittedFromDate", fromDate},
{"SubmittedToDate", toDate}
};
data.Update(EnumerateParam("FeedTypeList.Type.", feedTypes));
data.Update(EnumerateParam("FeedProcessingStatusList.Status.", processingStatuses));
return MakeRequest(data);
}
示例3: GetReportRequestList
public TreeWrapper GetReportRequestList(string[] requestIds = null, string[] types = null,
string[] processingStatuses = null, string maxCount = null,
string fromDate = null, string toDate = null)
{
var data = new Dictionary<string, string>() {
{"Action", "GetReportRequestList"},
{"MaxCount", maxCount},
{"RequestedFromDate", fromDate},
{"RequestedToDate", toDate},
};
data.Update(EnumerateParam("ReportRequestIdList.Id.", requestIds));
data.Update(EnumerateParam("ReportTypeList.Type.", types));
data.Update(EnumerateParam("ReportProcessingStatusList.Status.", processingStatuses));
return MakeRequest(data);
}
示例4: GetOrder
public TreeWrapper GetOrder(string[] amazonOrderIds)
{
var data = new Dictionary<string, string>() {
{"Action", "GetOrder"},
};
data.Update(EnumerateParam("AmazonOrderId.Id.", amazonOrderIds));
return MakeRequest(data);
}
示例5: GetCompetitivePricingForSku
/// <summary>
/// Returns the current competitive pricing of a product,
/// based on the SellerSKU and MarketplaceId that you specify.
/// </summary>
/// <param name="marketplaceId"></param>
/// <param name="skus"></param>
/// <returns></returns>
public TreeWrapper GetCompetitivePricingForSku(string marketplaceId, string[] skus)
{
var data = new Dictionary<string, string>() {
{"Action", "GetCompetitivePricingForSKU"},
{"MarketplaceId", marketplaceId},
};
data.Update(EnumerateParam("SellerSKUList.SellerSKU.", skus));
return MakeRequest(data);
}
示例6: GetCompetitivePricingForAsin
/// <summary>
/// Returns the current competitive pricing of a product,
/// based on the ASIN and MarketplaceId that you specify.
/// </summary>
/// <param name="?"></param>
/// <param name="?"></param>
/// <returns></returns>
public TreeWrapper GetCompetitivePricingForAsin(string marketplaceId, string[] asins)
{
var data = new Dictionary<string, string>() {
{"Action", "GetCompetitivePricingForASIN"},
{"MarketplaceId", marketplaceId},
};
data.Update(EnumerateParam("ASINList.ASIN.", asins));
return MakeRequest(data);
}
示例7: GetLowestOfferListingsForAsin
public TreeWrapper GetLowestOfferListingsForAsin(string marketplaceId, string[] asins,
string condition="All")
{
var data = new Dictionary<string, string>() {
{"Action", "GetLowestOfferListingsForASIN"},
{"MarketplaceId", marketplaceId},
{"ItemCondition", condition},
};
data.Update(EnumerateParam("ASINList.ASIN.", asins));
return MakeRequest(data);
}
示例8: RequestReport
public TreeWrapper RequestReport(string reportType, string startDate = null, string endDate = null,
string[] marketplaceIds = null)
{
var data = new Dictionary<string, string>() {
{"Action", "RequestReport"},
{"ReportType", reportType},
{"StartDate", startDate},
{"EndDate", endDate},
};
data.Update(EnumerateParam("MarketplaceIdList.Id.", marketplaceIds));
return MakeRequest(data);
}
示例9: GetReportCount
public TreeWrapper GetReportCount(string[] reportTypes = null, string acknowledged = null,
string fromDate = null, string toDate = null)
{
var data = new Dictionary<string, string>() {
{"Action", "GetReportCount"},
{"Acknowledged", acknowledged},
{"AvailableFromDate", fromDate},
{"AvailableToDate", toDate},
};
data.Update(EnumerateParam("ReportTypeList.Type.", reportTypes));
return MakeRequest(data);
}
示例10: ListOrders
public TreeWrapper ListOrders(string[] marketplaceIds, string createdAfter=null,
string createdBefore=null, string lastUpdatedAfter=null,
string lastUpdatedBefore=null, string[] orderStatus=null, string[] fulfillmentChannels=null,
string[] paymentMethods = null, string buyerEmail = null, string sellerOrderid = null,
int maxResults=100)
{
var data = new Dictionary<string, string>() {
{"Action", "ListOrders"},
{"CreatedAfter", createdAfter},
{"CreatedBefore", createdBefore},
{"LastUpdatedAfter", lastUpdatedAfter},
{"LastUpdatedBefore", lastUpdatedBefore},
{"BuyerEmail", buyerEmail},
{"SellerOrderId", sellerOrderid},
{"MaxResultsPerPage", maxResults.ToString()},
};
data.Update(EnumerateParam("OrderStatus.Status.", orderStatus));
data.Update(EnumerateParam("MarketplaceId.Id.", marketplaceIds));
data.Update(EnumerateParam("FulfillmentChannel.Channel.", fulfillmentChannels));
data.Update(EnumerateParam("PaymentMethod.Method.", paymentMethods));
return MakeRequest(data);
}
示例11: Update
public void Update()
{
Dictionary<int, int> dict = new Dictionary<int, int>();
dict.Add(1, 1);
dict.Add(2, 2);
dict.Add(3, 3);
dict.Add(4, 2);
Dictionary<int, int> dictCopy = new Dictionary<int, int>();
dictCopy.Add(1, 3);
dictCopy.Add(3, 9);
dict.Update(dictCopy);
Dictionary<int, int> dictOther = new Dictionary<int, int>();
dictOther.Add(1, 3);
dictOther.Add(2, 2);
dictOther.Add(3, 9);
dictOther.Add(4, 2);
Assert.AreEqual(dictOther, dict);
}
示例12: Parse
/// <summary>
/// Reads the KeyValuePairs from the given string and adds them to a dictionary
/// </summary>
/// <param name="dataString"></param>
/// <returns></returns>
public static Dictionary<string, string> Parse(string dataString)
{
var data = new Dictionary<string, string>();
StringBuilder strBuild = new StringBuilder();
bool isEscaped = false;
bool terminated = true;
bool isKey = true;
string key = "";
foreach (char c in dataString)
{
if (isEscaped)
{
isEscaped = false;
strBuild.Append(c);
continue;
}
switch (c)
{
case '"':
if (terminated)
{
//new key or value
terminated = false;
}
else
{
//end of key or value
terminated = true;
if (isKey)
{
key = strBuild.ToString();
}
else
{
data.Update(key, strBuild.ToString());
}
strBuild.Clear();
}
break;
case '\\':
if (!terminated)
isEscaped = true;
break;
case ':':
if (terminated)
isKey = false;
else
strBuild.Append(c);
break;
case ';':
if (terminated)
isKey = true;
else
strBuild.Append(c);
break;
default:
if (!terminated)
strBuild.Append(c);
break;
}
}
return data;
}
示例13: SubmitFeed
/// <summary>
/// Uploads a feed ( xml or .tsv ) to the seller's inventory.
/// Can be used for creating/updating products on amazon.
/// </summary>
/// <param name="feed"></param>
/// <param name="feed_type"></param>
/// <param name="marketplaceids"></param>
/// <param name="content_type"></param>
/// <param name="purge"></param>
/// <returns></returns>
public TreeWrapper SubmitFeed(string feed, string feedType, string[] marketplaceIds = null,
string contentType = "text/xml", string purge = "false")
{
var data = new Dictionary<string, string>() {
{"Action", "SubmitFeed"},
{"FeedType", feedType},
{"PurgeAndReplace", purge},
};
if (marketplaceIds != null)
data.Update(EnumerateParam("MarketplaceIdList.Id.", marketplaceIds));
var md = CalcMD5(feed);
var headers = new Dictionary<HttpRequestHeader, string>(){
{HttpRequestHeader.ContentMd5, md},
{HttpRequestHeader.ContentType, contentType},
};
return MakeRequest(data, WebRequestMethods.Http.Post, headers, feed);
}
示例14: MakeRequest
/// <summary>
/// Make request to Amazon MWS API with these parameters
/// </summary>
/// <param name="extraData"></param>
/// <param name="method"></param>
/// <param name="extraHeaders"></param>
/// <param name="body"></param>
/// <returns></returns>
public TreeWrapper MakeRequest(IDictionary<string, string> extraData,
string method = WebRequestMethods.Http.Get, IDictionary<HttpRequestHeader, string> extraHeaders = null,
string body = null)
{
var qParams = new Dictionary<string, string>(){
{"AWSAccessKeyId", this.accessKey},
{ACCOUNT_TYPE, this.accountId},
{"SignatureVersion", "2"},
{"Timestamp", this.GetTimestamp()},
{"Version", this.version},
{"SignatureMethod", "HmacSHA256"},
};
qParams.Update(extraData.Where(i => !string.IsNullOrEmpty(i.Value)).ToDictionary(p => p.Key, p => p.Value));
//TODO add encode('utf-8')
var requestDescription = string.Join("&",
from param in qParams
select
string.Format("{0}={1}",
param.Key, Uri.EscapeDataString(param.Value)));
var signature = this.CalcSignature(method, requestDescription);
var url = string.Format("{0}{1}?{2}&Signature={3}",
this.domain, this.uri, requestDescription, Uri.EscapeDataString(signature));
var request = (HttpWebRequest)WebRequest.Create(url);
request.Method = method.ToString();
request.UserAgent = "csharp-amazon-mws/0.0.1 (Language=CSharp)";
if (extraHeaders != null)
foreach (var x in extraHeaders)
request.Headers.Add(x.Key, x.Value);
if (!string.IsNullOrEmpty(body))
{
var dataStream = request.GetRequestStream();
var bytes = Encoding.UTF8.GetBytes(body);
dataStream.Write(bytes, 0, body.Length);
dataStream.Close();
}
var response = request.GetResponse();
var parsedResponse = new TreeWrapper(response.GetResponseStream(), NS);
response.Close();
return parsedResponse;
}
示例15: GetLowestOfferListingsForSku
public TreeWrapper GetLowestOfferListingsForSku(string marketplaceId, string[] skus,
string condition="Any")
{
var data = new Dictionary<string, string>() {
{"Action", "GetLowestOfferListingsForSKU"},
{"MarketplaceId", marketplaceId},
{"ItemCondition", condition},
};
data.Update(EnumerateParam("SellerSKUList.SellerSKU.", skus));
return MakeRequest(data);
}