• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IDictionary类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IDictionary的典型用法代码示例。如果您正苦于以下问题:C# IDictionary类的具体用法?C# IDictionary怎么用?C# IDictionary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: GetTestableChat

        public static TestableChat GetTestableChat(string connectionId, StateChangeTracker clientState, ChatUser user, IDictionary<string, Cookie> cookies)
        {
            // setup things needed for chat
            var repository = new InMemoryRepository();
            var resourceProcessor = new Mock<IResourceProcessor>();
            var chatService = new Mock<IChatService>();
            var connection = new Mock<IConnection>();
            var settings = new Mock<IApplicationSettings>();
            var mockPipeline = new Mock<IHubPipelineInvoker>();

            // add user to repository
            repository.Add(user);

            // create testable chat
            var chat = new TestableChat(settings, resourceProcessor, chatService, repository, connection);
            var mockedConnectionObject = chat.MockedConnection.Object;

            chat.Clients = new HubConnectionContext(mockPipeline.Object, mockedConnectionObject, "Chat", connectionId, clientState);

            var prinicipal = new Mock<IPrincipal>();

            var request = new Mock<IRequest>();
            request.Setup(m => m.Cookies).Returns(cookies);
            request.Setup(m => m.User).Returns(prinicipal.Object);

            // setup context
            chat.Context = new HubCallerContext(request.Object, connectionId);

            return chat;
        }
开发者ID:ucdavis,项目名称:JabbR,代码行数:30,代码来源:ChatFacts.cs


示例2: Invoke

        public Task Invoke(IDictionary<string, object> environment)
        {
            if (!environment.Get<string>(OwinConstants.RequestMethodKey).EqualsIgnoreCase("GET"))
            {
                return _inner(environment);
            }

            var originalOutput = environment.Get<Stream>(OwinConstants.ResponseBodyKey);
            var recordedStream = new MemoryStream();
            environment.Set(OwinConstants.ResponseBodyKey, recordedStream);

            return _inner(environment).ContinueWith(t => {
                recordedStream.Position = 0;
                environment[OwinConstants.ResponseBodyKey] = originalOutput;

                var response = new OwinHttpResponse(environment);

                if (IsGetHtmlRequest(environment) && response.StatusCode < 500)
                {
                    injectContent(environment, recordedStream, response);
                }
                else
                {
                    response.StreamContents(recordedStream);
                }
            });
        }
开发者ID:joemcbride,项目名称:fubumvc,代码行数:27,代码来源:HtmlHeadInjectionMiddleware.cs


示例3: CallAction

 private static void CallAction(Key key, IDictionary<Key, Action> delegates)
 {
     if (delegates.ContainsKey(key) && delegates[key] != null)
     {
         delegates[key]();
     }
 }
开发者ID:DannyGB,项目名称:OxTail,代码行数:7,代码来源:KeyboardHelper.cs


示例4: ClientPermissionsActionResult

 public ClientPermissionsActionResult(IViewService viewSvc, IDictionary<string, object> env, ClientPermissionsViewModel model)
     : base(async () => await viewSvc.ClientPermissions(model))
 {
     if (viewSvc == null) throw new ArgumentNullException("viewSvc");
     if (env == null) throw new ArgumentNullException("env");
     if (model == null) throw new ArgumentNullException("model");
 }
开发者ID:ridopark,项目名称:IdentityServer3,代码行数:7,代码来源:ClientPermissionsActionResult.cs


示例5: GetInt32

		public static int GetInt32(string property, IDictionary<string, string> properties, int defaultValue)
		{
			string toParse;
			properties.TryGetValue(property, out toParse);
			int result;
			return int.TryParse(toParse, out result) ? result : defaultValue;
		}
开发者ID:khaliyo,项目名称:Spring.net-NHibernate.net-Asp.net-MVC-DWZ-,代码行数:7,代码来源:PropertiesHelper.cs


示例6: BuildCacheStatic

		public static ICache BuildCacheStatic(string regionName, IDictionary<string,string> properties)
		{
			if (regionName != null && caches[regionName] != null)
			{
				return caches[regionName] as ICache;
			}

			if (regionName == null)
			{
				regionName = "";
			}
			if (properties == null)
			{
				properties = new Dictionary<string,string>();
			}
			if (log.IsDebugEnabled)
			{
				StringBuilder sb = new StringBuilder();
				foreach (KeyValuePair<string, string> de in properties)
				{
					sb.Append("name=");
					sb.Append(de.Key);
					sb.Append("&value=");
					sb.Append(de.Value);
					sb.Append(";");
				}
				log.Debug("building cache with region: " + regionName + ", properties: " + sb.ToString());
			}
			FooCache cache = new FooCache(regionName, properties);
			caches.Add(regionName, cache);
			return cache;
		}
开发者ID:marchlud,项目名称:nhibernate-core,代码行数:32,代码来源:Domain.cs


示例7: Invoke

        public async Task Invoke(IDictionary<string, object> environment)
        {
            int maxRedirects = _maxRedirects;

            while (maxRedirects >= 0)
            {
                await _next(environment);

                var response = new OwinResponse(environment);

                if (response.StatusCode == 302 || response.StatusCode == 301)
                {
                    string url = BuildRedirectUrl(response);

                    // Clear the env so we can make a new request
                    environment.Clear();

                    // Populate the env with new request data
                    RequestBuilder.BuildGet(environment, url);
                }
                else
                {
                    break;
                }

                maxRedirects--;
            }
        }
开发者ID:jango2015,项目名称:OwinHttpClient,代码行数:28,代码来源:RedirectMiddleware.cs


示例8: FormatRichTextPersistedDataForEditor

	    /// <summary>
	    /// This formats the persisted string to something useful for the rte so that the macro renders properly since we 
	    /// persist all macro formats like {?UMBRACO_MACRO macroAlias=\"myMacro\" /}
	    /// </summary>
	    /// <param name="persistedContent"></param>
	    /// <param name="htmlAttributes">The html attributes to be added to the div</param>
	    /// <returns></returns>
	    /// <remarks>
	    /// This converts the persisted macro format to this:
	    /// 
	    ///     {div class='umb-macro-holder'}
	    ///         <!-- <?UMBRACO_MACRO macroAlias=\"myMacro\" /> -->
	    ///         {ins}Macro alias: {strong}My Macro{/strong}{/ins}
	    ///     {/div}
	    /// 
	    /// </remarks>
	    internal static string FormatRichTextPersistedDataForEditor(string persistedContent, IDictionary<string ,string> htmlAttributes)
        {
            return MacroPersistedFormat.Replace(persistedContent, match =>
            {
                if (match.Groups.Count >= 3)
                {
                    //<div class="umb-macro-holder myMacro mceNonEditable">
                    var alias = match.Groups[2].Value;
                    var sb = new StringBuilder("<div class=\"umb-macro-holder ");
                    sb.Append(alias);
                    sb.Append(" mceNonEditable\"");
                    foreach (var htmlAttribute in htmlAttributes)
                    {
                        sb.Append(" ");
                        sb.Append(htmlAttribute.Key);
                        sb.Append("=\"");
                        sb.Append(htmlAttribute.Value);
                        sb.Append("\"");
                    }
                    sb.AppendLine(">");
                    sb.Append("<!-- ");
                    sb.Append(match.Groups[1].Value.Trim());
                    sb.Append(" />");
                    sb.AppendLine(" -->");
                    sb.Append("<ins>");
                    sb.Append("Macro alias: ");
                    sb.Append("<strong>");
                    sb.Append(alias);
                    sb.Append("</strong></ins></div>");
                    return sb.ToString();
                }
                //replace with nothing if we couldn't find the syntax for whatever reason
                return "";
            });
        }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:51,代码来源:MacroTagParser.cs


示例9: ParseAsync

        /// <summary>
        /// Tries to find a secret on the environment that can be used for authentication
        /// </summary>
        /// <param name="environment">The environment.</param>
        /// <returns>
        /// A parsed secret
        /// </returns>
        public async Task<ParsedSecret> ParseAsync(IDictionary<string, object> environment)
        {
            Logger.Debug("Start parsing for secret in post body");

            var context = new OwinContext(environment);
            var body = await context.ReadRequestFormAsync();

            if (body != null)
            {
                var id = body.Get("client_id");
                var secret = body.Get("client_secret");

                if (id.IsPresent() && secret.IsPresent())
                {
                    var parsedSecret = new ParsedSecret
                    {
                        Id = id,
                        Credential = secret,
                        Type = Constants.ParsedSecretTypes.SharedSecret
                    };

                    return parsedSecret;
                }
            }

            Logger.Debug("No secet in post body found");
            return null;
        }
开发者ID:nheijminkccv,项目名称:IdentityServer3,代码行数:35,代码来源:PostBodySecretParser.cs


示例10: Rectangle

 public Rectangle(IDictionary<ParamKeys, object> parameter)
     : base(parameter)
 {
     _edge1 = (double) parameter[ParamKeys.Edge1];
     _edge2 = (double) parameter[ParamKeys.Edge2];
     ShapeName = "Rectangle";
 }
开发者ID:VadymBratskyi,项目名称:Kottans-Homework,代码行数:7,代码来源:Rectangle.cs


示例11: SendEvent

 public async Task<HttpResponseMessage> SendEvent(string eventType, IDictionary<string, string> options) 
 {
     HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, endpointUrl);
     request.Content = GetRequestContent(eventType, options);
     var response = await HttpClient.SendAsync(request).ConfigureAwait(false);
     return response;
 }
开发者ID:phw,项目名称:kryd-dotnet,代码行数:7,代码来源:Client.cs


示例12: DELETE

        public static string DELETE(string uri, IDictionary<string, string> args)
        {
            try {
                WebClient client = new WebClient();

                client.Encoding = Encoding.UTF8;

                client.Headers["Connection"] = "Keep-Alive";
                StringBuilder formattedParams = new StringBuilder();

                IDictionary<string, string> parameters = new Dictionary<string, string>();

                foreach (var arg in args)
                {
                    parameters.Add(arg.Key, arg.Value);
                    formattedParams.AppendFormat("{0}={{{1}}}", arg.Key, arg.Key);
                }

                //Formatted URI
                Uri baseUri = new Uri(uri);

                client.UploadStringCompleted += new UploadStringCompletedEventHandler(client_UploadStringCompletedDelete);

                client.UploadStringAsync(baseUri, "DELETE", string.Empty);
                allDone.Reset();
                allDone.WaitOne();

                return requestResult;
            }
            catch (WebException ex) {
                return ReadResponse(ex.Response.GetResponseStream());
            }
        }
开发者ID:Injac,项目名称:InstaSharp-for-Windows-Phone-,代码行数:33,代码来源:HttpClient.cs


示例13: GetInt64

		public static long GetInt64(string property, IDictionary<string, string> properties, long defaultValue)
		{
			string toParse;
			properties.TryGetValue(property, out toParse);
			long result;
			return long.TryParse(toParse, out result) ? result : defaultValue;
		}
开发者ID:khaliyo,项目名称:Spring.net-NHibernate.net-Asp.net-MVC-DWZ-,代码行数:7,代码来源:PropertiesHelper.cs


示例14: GetValue

 public IItem GetValue(IDictionary<string, IItem> variables) {
   var stack = new Stack<object>();
   int i = 0;
   try {
     for (; i < tokens.Count; i++) {
       var token = tokens[i];
       double d;
       if (TryParse(token, out d)) {
         stack.Push(d);
       } else if (token.StartsWith("\"")) {
         stack.Push(GetVariableValue(variables, token.Substring(1, token.Length - 2).Replace("\\\"", "\"")));
       } else if (token.StartsWith("'")) {
         stack.Push(token.Substring(1, token.Length - 2).Replace("\\'", "'"));
       } else {
         Apply(token, stack, variables);
       }
     }
   } catch (Exception x) {
     throw new Exception(string.Format(
       "Calculation of '{1}'{0}failed at token #{2}: {3} {0}current stack is: {0}{4}", Environment.NewLine,
       Formula, i, TokenWithContext(tokens, i, 3),
       string.Join(Environment.NewLine, stack.Select(AsString))),
       x);
   }
   if (stack.Count != 1)
     throw new Exception(
       string.Format("Invalid final evaluation stack size {0} (should be 1) in formula '{1}'",
       stack.Count, Formula));
   var result = stack.Pop();
   if (result is string) return new StringValue((string)result);
   if (result is int) return new IntValue((int)result);
   if (result is double) return new DoubleValue((double)result);
   if (result is bool) return new BoolValue((bool)result);
   return null;
 }
开发者ID:t-h-e,项目名称:HeuristicLab,代码行数:35,代码来源:Calculator.cs


示例15: ToSqlString

        public override SqlString ToSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary<string, IFilter> enabledFilters)
        {
            var sqlBuilder = new SqlStringBuilder();
            SqlString[] columnNames = null;

            if (_propertyName != "*")
            {
                columnNames = CriterionUtil.GetColumnNames(_propertyName, _projection, criteriaQuery, criteria, enabledFilters);

                if (columnNames.Length != 1)
                {
                    throw new HibernateException("Contains may only be used with single-column properties");
                }
            } else
            {
                columnNames = new SqlString[]
                                  {
                                      new SqlString("*")
                                  };
            }

            sqlBuilder.Add("contains(")
              .Add(columnNames[0])
              .Add(",");

            sqlBuilder.Add(criteriaQuery.NewQueryParameter(GetParameterTypedValue(criteria, criteriaQuery)).Single());
            sqlBuilder.Add(")");

            return sqlBuilder.ToSqlString();
        }
开发者ID:theriddlebrothers,项目名称:Honeypot,代码行数:30,代码来源:ContainsExpression.cs


示例16: GetInstance

        public static SearchResultsBaseDto GetInstance(IDictionary<string, object> item)
        {
            // make sure this is a policy one
            if ((item["ContentType"] != null) && (item["ContentType"].ToString().ToLower().Equals("broker")))
            {
                var newItem = new SearchResultBrokerDto();

                newItem.BrokerContact = (GetItemObject(item, "VALBkrCtc") == null) ? null : item["VALBkrCtc"].ToString();
                newItem.BrokerGroupCode = (GetItemObject(item, "VALBkrGrpCd") == null) ? null : item["VALBkrGrpCd"].ToString();
                newItem.BrokerCode = (GetItemObject(item, "VALBkrCd") == null) ? null : item["VALBkrCd"].ToString();
                newItem.BrokerName = (GetItemObject(item, "VALBkrNm") == null) ? null : item["VALBkrNm"].ToString();
                newItem.BrokerPSU = (GetItemObject(item, "VALBkrPsu") == null) ? null : item["VALBkrPsu"].ToString();
                newItem.BrokerSeqId = (GetItemObject(item, "VALBkrSeqId") == null)
                                  ? 0
                                  : Int32.Parse(item["VALBkrSeqId"].ToString());
                newItem.HitHightlightSummary = (GetItemObject(item, "HITHIGHLIGHTEDSUMMARY") == null)
                                           ? null
                                           : item["HITHIGHLIGHTEDSUMMARY"].ToString();
                newItem.View = _View;
                if ((string.IsNullOrEmpty(newItem.BrokerName)) || (string.IsNullOrEmpty(newItem.BrokerCode)))
                    return null;
                return newItem;
            }
            return null;
        }
开发者ID:Eugene-Murray,项目名称:EM.Contract.Validus,代码行数:25,代码来源:SearchResultBrokerDto.cs


示例17: ObjectDataSourceStatusEventArgs

 public ObjectDataSourceStatusEventArgs(object returnValue, IDictionary outputParameters, System.Exception exception)
 {
     this._affectedRows = -1;
     this._returnValue = returnValue;
     this._outputParameters = outputParameters;
     this._exception = exception;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:ObjectDataSourceStatusEventArgs.cs


示例18: GetModelData

        public string GetModelData(ModuleInstanceView parent, string settingsData, IDictionary<string, string> parameters, bool isConfigView)
        {
            SearchView viewSettings = null;

            if (string.IsNullOrEmpty(settingsData))
                viewSettings = new SearchView();
            else
                viewSettings = CommonUtils.JsonDeserialize<SearchView>(settingsData);

            viewSettings.EnsureStandardSettings();

            if (isConfigView)
                viewSettings = BuildAdminSettingsView(parent, viewSettings);
            else
            {
                if (parameters.ContainsKey("Command"))
                {
                    if (parameters["Command"] == "LoadDropdown")
                        return LoadDropdownValues(parent, viewSettings, parameters);
                }
                viewSettings = BuildPublicSettingsView(parent, viewSettings, parameters);
                viewSettings.AvailableFields.Clear();
            }

            return CommonUtils.JsonSerializeMinimum(viewSettings);
        }
开发者ID:rickeygalloway,项目名称:Test,代码行数:26,代码来源:PublicSearchViewHelper.cs


示例19: Serialize

        protected override void Serialize(IDictionary<string, object> json)
        {
            if (EndLabel != DefaultEndLabel)
            {
                json["endLabel"] = EndLabel;
            }

            if (EndNever != DefaultEndNever)
            {
                json["endNever"] = EndNever;
            }

            if (EndCountAfter != DefaultEndCountAfter)
            {
                json["endCountAfter"] = EndCountAfter;
            }

            if (EndCountOccurrence != DefaultEndCountOccurrence)
            {
                json["endCountOccurrence"] = EndCountOccurrence;
            }

            if (EndUntilOn != DefaultEndUntilOn)
            {
                json["endUntilOn"] = EndUntilOn;
            }
        }
开发者ID:wanaxe,项目名称:Study,代码行数:27,代码来源:SchedulerRecurrenceEditorEndMessages.cs


示例20: GlimpseRequest

        /// <summary>
        /// Initializes a new instance of the <see cref="GlimpseRequest" /> class.
        /// </summary>
        /// <param name="requestId">The request id.</param>
        /// <param name="requestMetadata">The request metadata.</param>
        /// <param name="tabData">The plugin data.</param>
        /// <param name="displayData">The display data</param>
        /// <param name="duration">The duration.</param>
        public GlimpseRequest(Guid requestId, IRequestMetadata requestMetadata, IDictionary<string, TabResult> tabData, IDictionary<string, TabResult> displayData, TimeSpan duration)
            : this()
        {
            RequestId = requestId;
            TabData = tabData;
            DisplayData = displayData;
            Duration = duration;

            RequestHttpMethod = requestMetadata.RequestHttpMethod;
            RequestIsAjax = requestMetadata.RequestIsAjax;
            RequestUri = requestMetadata.RequestUri;
            ResponseStatusCode = requestMetadata.ResponseStatusCode;
            ResponseContentType = requestMetadata.ResponseContentType;
            ClientId = requestMetadata.GetCookie(Constants.ClientIdCookieName) ?? requestMetadata.ClientId;
            UserAgent = requestMetadata.GetHttpHeader(Constants.UserAgentHeaderName);

            Guid parentRequestId;

#if NET35
            if (RequestIsAjax && Glimpse.Core.Backport.Net35Backport.TryParseGuid(requestMetadata.GetHttpHeader(Constants.HttpRequestHeader), out parentRequestId))
            {
                ParentRequestId = parentRequestId;
            }
#else
            if (RequestIsAjax && Guid.TryParse(requestMetadata.GetHttpHeader(Constants.HttpRequestHeader), out parentRequestId))
            {
                ParentRequestId = parentRequestId;
            }
#endif
        }
开发者ID:GProulx,项目名称:Glimpse,代码行数:38,代码来源:GlimpseRequest.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IDictionaryAdapter类代码示例发布时间:2022-05-24
下一篇:
C# IDicomAttributeProvider类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap