当前位置: 首页>>代码示例>>C#>>正文


C# IDictionary.Put方法代码示例

本文整理汇总了C#中IDictionary.Put方法的典型用法代码示例。如果您正苦于以下问题:C# IDictionary.Put方法的具体用法?C# IDictionary.Put怎么用?C# IDictionary.Put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDictionary的用法示例。


在下文中一共展示了IDictionary.Put方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UnsavedRevision

 protected internal UnsavedRevision(Document document, SavedRevision parentRevision
     ) : base(document)
 {
     if (parentRevision == null)
     {
         parentRevID = null;
     }
     else
     {
         parentRevID = parentRevision.GetId();
     }
     IDictionary<string, object> parentRevisionProperties;
     if (parentRevision == null)
     {
         parentRevisionProperties = null;
     }
     else
     {
         parentRevisionProperties = parentRevision.GetProperties();
     }
     if (parentRevisionProperties == null)
     {
         properties = new Dictionary<string, object>();
         properties.Put("_id", document.GetId());
         if (parentRevID != null)
         {
             properties.Put("_rev", parentRevID);
         }
     }
     else
     {
         properties = new Dictionary<string, object>(parentRevisionProperties);
     }
 }
开发者ID:jonlipsky,项目名称:couchbase-lite-net,代码行数:34,代码来源:UnsavedRevision.cs

示例2: Attachment

		internal Attachment(InputStream contentStream, string contentType)
		{
			this.body = contentStream;
			metadata = new Dictionary<string, object>();
			metadata.Put("content_type", contentType);
			metadata.Put("follows", true);
			this.gzipped = false;
		}
开发者ID:Redth,项目名称:couchbase-lite-net,代码行数:8,代码来源:Attachment.cs

示例3: SetUp

		protected virtual void SetUp()
		{
			// set up a reference map
			reference = new LinkedHashMap<object, object>();
			reference.Put("a", "a");
			reference.Put("b", true);
			reference.Put("c", new Dictionary<object, object>());
			reference.Put(1, 42);
			// get a js object as map
			Context context = Context.Enter();
			ScriptableObject scope = context.InitStandardObjects();
			map = (IDictionary<object, object>)context.EvaluateString(scope, "({ a: 'a', b: true, c: new java.util.HashMap(), 1: 42});", "testsrc", 1, null);
			Context.Exit();
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:14,代码来源:Bug448816Test.cs

示例4: DynamicTimeRangeFacetHandler

        /// <summary>
        /// Initializes a new instance of <see cref="T:DynamicTimeRangeFacetHandler"/>.
        /// The format of range string is dddhhmmss. (ddd: days (000-999), hh : hours (00-23), mm: minutes (00-59), ss: seconds (00-59))
        /// </summary>
        /// <param name="name">The facet handler name.</param>
        /// <param name="dataFacetName">The facet handler this one depends on.</param>
        /// <param name="currentTime">The number of milliseconds since January 1, 1970 expessed in universal coordinated time (UTC). 
        /// The <see cref="M:BoboBrowse.Net.Support.DateTimeExtensions.GetTime"/> method can be used to convert the current time to 
        /// this format, e.g. DateTime.Now.GetTime().</param>
        /// <param name="ranges">A list of range strings in the format dddhhmmss. (ddd: days (000-999), hh : hours (00-23), mm: minutes (00-59), ss: seconds (00-59))</param>
        public DynamicTimeRangeFacetHandler(string name, string dataFacetName, long currentTime, IEnumerable<string> ranges)
            : base(name, dataFacetName)
        {
            if (log.IsDebugEnabled)
            {
                log.Debug(name + " " + dataFacetName + " " + currentTime);
            }
            List<string> sortedRanges = new List<string>(ranges);
            sortedRanges.Sort();

            _valueToRangeStringMap = new Dictionary<string, string>();
            _rangeStringToValueMap = new Dictionary<string, string>();
            _rangeStringList = new List<string>(ranges.Count());

            string prev = "000000000";
            foreach (string range in sortedRanges)
            {
                string rangeString = BuildRangeString(currentTime, prev, range);
                _valueToRangeStringMap.Put(range, rangeString);
                _rangeStringToValueMap.Put(rangeString, range);
                _rangeStringList.Add(rangeString);
                prev = range;

                if (log.IsDebugEnabled)
                {
                    log.Debug(range + "\t " + rangeString);
                }
            }
        }
开发者ID:yao-yi,项目名称:BoboBrowse.Net,代码行数:39,代码来源:DynamicTimeRangeFacetHandler.cs

示例5: MappedFacetAccessible

 public MappedFacetAccessible(BrowseFacet[] facets)
 {
     _facetMap = new Dictionary<object, BrowseFacet>();
     foreach (BrowseFacet facet in facets)
     {
         _facetMap.Put(facet.Value, facet);
     }
     _facets = facets;
 }
开发者ID:yao-yi,项目名称:BoboBrowse.Net,代码行数:9,代码来源:MappedFacetAccessible.cs

示例6: RawParseUtils

 static RawParseUtils()
 {
     encodingAliases = new Dictionary<string, System.Text.Encoding>();
     encodingAliases.Put("latin-1", Sharpen.Extensions.GetEncoding("ISO-8859-1"));
     digits10 = new byte[(byte)('9') + 1];
     Arrays.Fill(digits10, unchecked((byte)-1));
     for (char i = '0'; i <= '9'; i++)
     {
         digits10[i] = unchecked((byte)(i - (byte)('0')));
     }
     digits16 = new sbyte[(byte)('f') + 1];
     Arrays.Fill(digits16, (sbyte)-1);
     for (char i_1 = '0'; i_1 <= '9'; i_1++)
     {
         digits16[i_1] = (sbyte)(i_1 - (sbyte)('0'));
     }
     for (char i_2 = 'a'; i_2 <= 'f'; i_2++)
     {
         digits16[i_2] = (sbyte)((i_2 - (sbyte)('a')) + 10);
     }
     for (char i_3 = 'A'; i_3 <= 'F'; i_3++)
     {
         digits16[i_3] = (sbyte)((i_3 - (sbyte)('A')) + 10);
     }
     footerLineKeyChars = new byte[(byte)('z') + 1];
     footerLineKeyChars[(byte)('-')] = 1;
     for (char i_4 = '0'; i_4 <= '9'; i_4++)
     {
         footerLineKeyChars[i_4] = 1;
     }
     for (char i_5 = 'A'; i_5 <= 'Z'; i_5++)
     {
         footerLineKeyChars[i_5] = 1;
     }
     for (char i_6 = 'a'; i_6 <= 'z'; i_6++)
     {
         footerLineKeyChars[i_6] = 1;
     }
 }
开发者ID:sharwell,项目名称:ngit,代码行数:39,代码来源:RawParseUtils.cs

示例7: GetChangesFeedParams

        internal IDictionary<string, object> GetChangesFeedParams()
        {
            if (docIDs != null && docIDs.Count > 0) {
                filterName = "_doc_ids";
                filterParams = new Dictionary<string, object>();
                filterParams.Put("doc_ids", docIDs);
            }

            var bodyParams = new Dictionary<string, object>();
            bodyParams["feed"] = GetFeed();
            bodyParams["heartbeat"] = _heartbeatMilliseconds;

            if (includeConflicts) {
                bodyParams["style"] = "all_docs";
            } else {
                bodyParams["style"] = null;
            }

            if (lastSequenceID != null) {
                Int64 sequenceAsLong;
                var success = Int64.TryParse(lastSequenceID.ToString(), out sequenceAsLong);
                bodyParams["since"] = success ? sequenceAsLong : lastSequenceID;
            }

            if (mode == ChangeTrackerMode.LongPoll) {
                bodyParams["limit"] = LongPollModeLimit;
            }

            if (filterName != null) {
                bodyParams["filter"] = filterName;
                bodyParams.PutAll(filterParams);
            }

            return bodyParams;
        }
开发者ID:transformersprimeabcxyz,项目名称:_TO-DO-couchbase-lite-net-couchbase,代码行数:35,代码来源:ChangeTracker.cs

示例8: GetChangesFeedPath

		public virtual string GetChangesFeedPath()
		{
			string path = "_changes?feed=";
			switch (mode)
			{
				case ChangeTracker.ChangeTrackerMode.OneShot:
				{
					path += "normal";
					break;
				}

				case ChangeTracker.ChangeTrackerMode.LongPoll:
				{
					path += "longpoll&limit=50";
					break;
				}

				case ChangeTracker.ChangeTrackerMode.Continuous:
				{
					path += "continuous";
					break;
				}
			}
			path += "&heartbeat=300000";
			if (includeConflicts)
			{
				path += "&style=all_docs";
			}
			if (lastSequenceID != null)
			{
				path += "&since=" + URLEncoder.Encode(lastSequenceID.ToString());
			}
			if (docIDs != null && docIDs.Count > 0)
			{
				filterName = "_doc_ids";
				filterParams = new Dictionary<string, object>();
				filterParams.Put("doc_ids", docIDs);
			}
			if (filterName != null)
			{
				path += "&filter=" + URLEncoder.Encode(filterName);
				if (filterParams != null)
				{
					foreach (string filterParamKey in filterParams.Keys)
					{
						object value = filterParams.Get(filterParamKey);
						if (!(value is string))
						{
							try
							{
								value = Manager.GetObjectMapper().WriteValueAsString(value);
							}
							catch (IOException e)
							{
								throw new ArgumentException(e);
							}
						}
						path += "&" + URLEncoder.Encode(filterParamKey) + "=" + URLEncoder.Encode(value.ToString
							());
					}
				}
			}
			return path;
		}
开发者ID:Redth,项目名称:couchbase-lite-net,代码行数:64,代码来源:ChangeTracker.cs

示例9: GetChangesFeedPath

        public string GetChangesFeedPath()
        {
            if (UsePost)
            {
                return "_changes";
            }

            var path = new StringBuilder("_changes?feed=");
            path.Append(GetFeed());

            if (mode == ChangeTrackerMode.LongPoll)
            {
                path.Append(string.Format("&limit={0}", LongPollModeLimit));
            }
            path.Append(string.Format("&heartbeat={0}", _heartbeatMilliseconds));
            if (includeConflicts)
            {
                path.Append("&style=all_docs");
            }
            if (lastSequenceID != null)
            {
                path.Append("&since=");
                path.Append(Uri.EscapeUriString(lastSequenceID.ToString()));
            }
            if (docIDs != null && docIDs.Count > 0)
            {
                filterName = "_doc_ids";
                filterParams = new Dictionary<string, object>();
                filterParams.Put("doc_ids", docIDs);
            }
            if (filterName != null)
            {
                path.Append("&filter=");
                path.Append(Uri.EscapeUriString(filterName));
                if (filterParams != null)
                {
                    foreach (string filterParamKey in filterParams.Keys)
                    {
                        var value = filterParams.Get(filterParamKey);
                        if (!(value is string))
                        {
                            try
                            {
                                value = Manager.GetObjectMapper().WriteValueAsString(value);
                            }
                            catch (IOException e)
                            {
                                throw new InvalidOperationException("Unable to JSON-serialize a filter parameter value.", e);
                            }
                        }
                        path.Append("&");
                        path.Append(Uri.EscapeUriString(filterParamKey));
                        path.Append("=");
                        path.Append(Uri.EscapeUriString(value.ToString()));
                    }
                }
            }
            return path.ToString();
        }
开发者ID:SunilDhaker,项目名称:couchbase-lite-net,代码行数:59,代码来源:ChangeTracker.cs

示例10: InitDCArrays

 // Don't let failures (like a bad dc:rights form) stop other
 // cleanup.
 /// <summary>
 /// Initializes the map that contains the known arrays, that are fixed by
 /// <see cref="NormalizeDCArrays(XMPNode)"/>
 /// .
 /// </summary>
 private static void InitDCArrays()
 {
     dcArrayForms = new Hashtable();
     // Properties supposed to be a "Bag".
     PropertyOptions bagForm = new PropertyOptions();
     bagForm.SetArray(true);
     dcArrayForms.Put("dc:contributor", bagForm);
     dcArrayForms.Put("dc:language", bagForm);
     dcArrayForms.Put("dc:publisher", bagForm);
     dcArrayForms.Put("dc:relation", bagForm);
     dcArrayForms.Put("dc:subject", bagForm);
     dcArrayForms.Put("dc:type", bagForm);
     // Properties supposed to be a "Seq".
     PropertyOptions seqForm = new PropertyOptions();
     seqForm.SetArray(true);
     seqForm.SetArrayOrdered(true);
     dcArrayForms.Put("dc:creator", seqForm);
     dcArrayForms.Put("dc:date", seqForm);
     // Properties supposed to be an "Alt" in alternative-text form.
     PropertyOptions altTextForm = new PropertyOptions();
     altTextForm.SetArray(true);
     altTextForm.SetArrayOrdered(true);
     altTextForm.SetArrayAlternate(true);
     altTextForm.SetArrayAltText(true);
     dcArrayForms.Put("dc:description", altTextForm);
     dcArrayForms.Put("dc:rights", altTextForm);
     dcArrayForms.Put("dc:title", altTextForm);
 }
开发者ID:Sicos1977,项目名称:n-metadata-extractor,代码行数:35,代码来源:XMPNormalizer.cs

示例11: InitHash

		internal static object InitHash(IDictionary<object, object> h, object key, object initialValue)
		{
			lock (h)
			{
				object current = h.Get(key);
				if (current == null)
				{
					h.Put(key, initialValue);
				}
				else
				{
					initialValue = current;
				}
			}
			return initialValue;
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:16,代码来源:Kit.cs

示例12: ParseHeaders

		public virtual void ParseHeaders(string headersStr)
		{
			headers = new Dictionary<string, string>();
			if (headersStr != null && headersStr.Length > 0)
			{
				headersStr = headersStr.Trim();
				StringTokenizer tokenizer = new StringTokenizer(headersStr, "\r\n");
				while (tokenizer.HasMoreTokens())
				{
					string header = tokenizer.NextToken();
					if (!header.Contains(":"))
					{
						throw new ArgumentException("Missing ':' in header line: " + header);
					}
					StringTokenizer headerTokenizer = new StringTokenizer(header, ":");
					string key = headerTokenizer.NextToken().Trim();
					string value = headerTokenizer.NextToken().Trim();
					headers.Put(key, value);
				}
			}
		}
开发者ID:Redth,项目名称:couchbase-lite-net,代码行数:21,代码来源:MultipartReader.cs

示例13: DiscoverAccessibleMethods

		private static void DiscoverAccessibleMethods(Type clazz, IDictionary<JavaMembers.MethodSignature, MethodInfo> map, bool includeProtected, bool includePrivate)
		{
			if (Modifier.IsPublic(clazz.Attributes) || includePrivate)
			{
				try
				{
					if (includeProtected || includePrivate)
					{
						while (clazz != null)
						{
							try
							{
								MethodInfo[] methods = Sharpen.Runtime.GetDeclaredMethods(clazz);
								foreach (MethodInfo method in methods)
								{
									int mods = method.Attributes;
									if (Modifier.IsPublic(mods) || Modifier.IsProtected(mods) || includePrivate)
									{
										JavaMembers.MethodSignature sig = new JavaMembers.MethodSignature(method);
										if (!map.ContainsKey(sig))
										{
											if (includePrivate && !method.IsAccessible())
											{
											}
											map.Put(sig, method);
										}
									}
								}
								clazz = clazz.BaseType;
							}
							catch (SecurityException)
							{
								// Some security settings (i.e., applets) disallow
								// access to Class.getDeclaredMethods. Fall back to
								// Class.getMethods.
								MethodInfo[] methods = clazz.GetMethods();
								foreach (MethodInfo method in methods)
								{
									JavaMembers.MethodSignature sig = new JavaMembers.MethodSignature(method);
									if (!map.ContainsKey(sig))
									{
										map.Put(sig, method);
									}
								}
								break;
							}
						}
					}
					else
					{
						// getMethods gets superclass methods, no
						// need to loop any more
						MethodInfo[] methods = clazz.GetMethods();
						foreach (MethodInfo method in methods)
						{
							JavaMembers.MethodSignature sig = new JavaMembers.MethodSignature(method);
							// Array may contain methods with same signature but different return value!
							if (!map.ContainsKey(sig))
							{
								map.Put(sig, method);
							}
						}
					}
					return;
				}
				catch (SecurityException)
				{
					Context.ReportWarning("Could not discover accessible methods of class " + clazz.FullName + " due to lack of privileges, " + "attemping superclasses/interfaces.");
				}
			}
			// Fall through and attempt to discover superclass/interface
			// methods
			Type[] interfaces = clazz.GetInterfaces();
			foreach (Type intface in interfaces)
			{
				DiscoverAccessibleMethods(intface, map, includeProtected, includePrivate);
			}
			Type superclass = clazz.BaseType;
			if (superclass != null)
			{
				DiscoverAccessibleMethods(superclass, map, includeProtected, includePrivate);
			}
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:83,代码来源:JavaMembers.cs

示例14: Digest

 internal Digest(string hdr)
 {
     @params = Parse(hdr);
     string qop = @params.Get("qop");
     if ("auth".Equals(qop))
     {
         byte[] bin = new byte[8];
         PRNG.NextBytes(bin);
         @params.Put("cnonce", Base64.EncodeBytes(bin));
     }
 }
开发者ID:sharwell,项目名称:ngit,代码行数:11,代码来源:HttpAuthMethod.cs

示例15: ChangesFeedPOSTBodyMap

 public virtual IDictionary<string, object> ChangesFeedPOSTBodyMap()
 {
     if (!usePOST)
     {
         return null;
     }
     if (docIDs != null && docIDs.Count > 0)
     {
         filterName = "_doc_ids";
         filterParams = new Dictionary<string, object>();
         filterParams.Put("doc_ids", docIDs);
     }
     IDictionary<string, object> post = new Dictionary<string, object>();
     post.Put("feed", GetFeed());
     post.Put("heartbeat", GetHeartbeatMilliseconds());
     if (includeConflicts)
     {
         post.Put("style", "all_docs");
     }
     else
     {
         post.Put("style", null);
     }
     if (lastSequenceID != null)
     {
         try
         {
             post.Put("since", long.Parse(lastSequenceID.ToString()));
         }
         catch (FormatException)
         {
             post.Put("since", lastSequenceID.ToString());
         }
     }
     if (mode == ChangeTracker.ChangeTrackerMode.LongPoll && limit > 0)
     {
         post.Put("limit", limit);
     }
     else
     {
         post.Put("limit", null);
     }
     if (filterName != null)
     {
         post.Put("filter", filterName);
         post.PutAll(filterParams);
     }
     return post;
 }
开发者ID:transformersprimeabcxyz,项目名称:_TO-DO-couchbase-lite-net-couchbase,代码行数:49,代码来源:ChangeTracker.cs


注:本文中的IDictionary.Put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。