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


C# IDictionary.Contains方法代码示例

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


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

示例1: postAction

    public void postAction(string actionId, IDictionary actionProperties, string objectId,
                           IDictionary objectProperties, string objectInstanceId = null,
                           CarrotRequestResponse callback = null)
    {
        if(string.IsNullOrEmpty(objectId))
        {
            throw new ArgumentNullException("objectId must not be null or empty string.", "objectId");
        }

        if(string.IsNullOrEmpty(actionId))
        {
            throw new ArgumentNullException("actionId must not be null or empty string.", "actionId");
        }

        if(objectProperties == null)
        {
            throw new ArgumentNullException("objectProperties must not be null.", "objectProperties");
        }
        else if(!objectProperties.Contains("title") ||
                !objectProperties.Contains("description") ||
                !objectProperties.Contains("image"))
        {
            throw new ArgumentException("objectProperties must contain keys for 'title', 'description', and 'image'.", "objectProperties");
        }

        objectProperties["object_type"] = objectId;
        if(!string.IsNullOrEmpty(objectInstanceId)) objectProperties["object_instance_id"] = objectInstanceId;
        Dictionary<string, object> parameters = new Dictionary<string, object>() {
            {"action_id", actionId},
            {"action_properties", actionProperties == null ? new Dictionary<string, object>() : actionProperties},
            {"object_properties", objectProperties}
        };
        StartCoroutine(cachedRequestCoroutine(ServiceType.Post, "/me/actions.json", parameters, callback));
    }
开发者ID:GoCarrotArchive,项目名称:carrot-unity,代码行数:34,代码来源:CarrotObsolete.cs

示例2: ExecuteRule

 /// <summary> Returns a value cast to a specific type
 /// *
 /// </summary>
 /// <param name="aBrc">- The BRERuleContext object
 /// </param>
 /// <param name="aMap">- The IDictionary of parameters from the XML
 /// </param>
 /// <param name="aStep">- The step that it is on
 /// </param>
 /// <returns> The value cast to the specified type
 /// 
 /// </returns>
 public object ExecuteRule(IBRERuleContext aBrc, IDictionary aMap, object aStep)
 {
     bool staticCall = false;
     if (!aMap.Contains(OBJECTID))
     {
         if (!aMap.Contains(TYPE))
             throw new BRERuleException("Parameter 'Type' or 'ObjectId' not found");
         else staticCall = true;
     }
     if (!aMap.Contains(MEMBER))
     {
         throw new BRERuleException("Parameter 'Member' not found");
     }
     else
     {
         if (staticCall)
             return Reflection.ClassCall((string)aMap[TYPE],
                                            (string)aMap[MEMBER],
                                            GetArguments(aMap));
         else
             return Reflection.ObjectCall(aBrc.GetResult(aMap[OBJECTID]).Result,
                                            (string)aMap[MEMBER],
                                            GetArguments(aMap));
     }
 }
开发者ID:plamikcho,项目名称:xbrlpoc,代码行数:37,代码来源:ObjectLookup.cs

示例3: ClientWorkflowInvoker

		/// <summary></summary>
		public ClientWorkflowInvoker(IDictionary properties, IClientChannelSinkProvider clientSinkProvider) 
		{	
			try 
			{	
                // configuration file
			    if(properties.Contains("timeout"))
                    _TimeOut = Convert.ToInt32(properties["timeout"]);
                if (properties.Contains("name"))
                    _ChannelName = Convert.ToString(properties["name"]);
                if (properties.Contains("callcontextActor"))
                    _CallContextActor = Convert.ToString(properties["callcontextActor"]);
             
				// channel provider
				_Provider = clientSinkProvider == null ? new BinaryClientFormatterSinkProvider() : clientSinkProvider;

				// add the ClientWorkflowInvokerProvider at the end
				IClientChannelSinkProvider provider = _Provider;
                while (provider.Next != null)
                {
                    provider = provider.Next;
                }
				provider.Next = new ClientWorkflowInvokerProvider();
			}
			catch(Exception ex) 
			{
                Trace.WriteLine(ex);
			}
		}
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:29,代码来源:ClientWorkflowInvoker.cs

示例4: AndroidNotificationPayload

        public AndroidNotificationPayload(IDictionary _payloadDict)
        {
            AndroidProperties		= new AndroidSpecificProperties();

            // Alert
            if (_payloadDict.Contains(NPSettings.Notification.Android.ContentTextKey))
            {
                //Check here which key is being received.
                Console.Log(Constants.kDebugTag, "[BillingTransaction] " + _payloadDict.ToJSON());//TODO
                object _alertUnknownType	= _payloadDict[ContentTextKey] as object;

                // String type
                if ((_alertUnknownType as string) != null)
                {
                    AlertBody	= _alertUnknownType as string;
                }
            }

            if (_payloadDict.Contains(UserInfoKey))
                UserInfo		= _payloadDict[UserInfoKey] as IDictionary;

            // Fire date
            long _secsFromNow	= _payloadDict.GetIfAvailable<long>(kFireDate);

            FireDate			= _secsFromNow.ToDateTimeFromJavaTime();

            // Sound, Badge
            AndroidProperties.ContentTitle		=  	_payloadDict.GetIfAvailable<string>(ContentTitleKey);
            AndroidProperties.TickerText		=  	_payloadDict.GetIfAvailable<string>(TickerTextKey);
            AndroidProperties.Tag				=  	_payloadDict.GetIfAvailable<string>(TagKey);

            //Added in 1.03
            AndroidProperties.CustomSound		= 	_payloadDict.GetIfAvailable<string>(kCustomSound);
            AndroidProperties.LargeIcon			= 	_payloadDict.GetIfAvailable<string>(kLargeIcon);
        }
开发者ID:yourimpark,项目名称:soma_1st_yourimpark,代码行数:35,代码来源:AndroidNotificationPayload.cs

示例5: PreFilterProperties

 /// <summary>
 /// Drops the BackgroundImage property
 /// </summary>
 /// <param name="properties">properties to remove BackGroundImage from</param>
 protected override void PreFilterProperties(IDictionary properties)
 {
     base.PreFilterProperties(properties);
     if (properties.Contains("BackgroundImage"))
         properties.Remove("BackgroundImage");
     if (properties.Contains("DrawGrid"))
         properties.Remove("DrawGrid");
 }
开发者ID:CoreCompat,项目名称:LibUsbDotNet,代码行数:12,代码来源:HeaderDesigner.cs

示例6: InitializeData

	public void InitializeData(IDictionary JSON) {

		

		if(JSON.Contains("id")) {
			_id 								= System.Convert.ToString(JSON["id"]);
		}


		if(JSON.Contains("birthday")) {
			_Birthday 							=DateTime.Parse(System.Convert.ToString(JSON["birthday"])); 
		}


		if(JSON.Contains("name")) {
			_name 								= System.Convert.ToString(JSON["name"]);
		}

		if(JSON.Contains("first_name")) {
			_first_name 								= System.Convert.ToString(JSON["first_name"]);
		}

		if(JSON.Contains("last_name")) {
			_last_name 								= System.Convert.ToString(JSON["last_name"]);
		}

		if(JSON.Contains("username")) {
			_username 								= System.Convert.ToString(JSON["username"]);
		}

		if(JSON.Contains("link")) {
			_profile_url 								= System.Convert.ToString(JSON["link"]);
		}

		if(JSON.Contains("email")) {
			_email 								= System.Convert.ToString(JSON["email"]);
		}

		if(JSON.Contains("locale")) {
			_locale 								= System.Convert.ToString(JSON["locale"]);
		}

		if(JSON.Contains("location")) {
			IDictionary loc = JSON["location"] as IDictionary;
			_location							= System.Convert.ToString(loc["name"]);
		}

		if(JSON.Contains("gender")) {
			string g = System.Convert.ToString(JSON["gender"]);
			if(g.Equals("male")) {
				_gender = FB_Gender.Male;
			} else {
				_gender = FB_Gender.Female;
			}
		}


	}
开发者ID:Avatarchik,项目名称:UnityZombieCross,代码行数:58,代码来源:FB_UserInfo.cs

示例7: DynamoErrorLog

        public DynamoErrorLog(IDictionary config)
        {
            if (config == null)
                throw new ArgumentNullException("config");
            if (!config.Contains("applicationName"))
                throw new InvalidOperationException("'applicationName' attribute missing from Elmah config");
            string appName = (string)config["applicationName"];
            ApplicationName = appName;

            if (config.Contains("tableName"))
                s_TableName = (string)config["tableName"];
        }
开发者ID:howcheng,项目名称:elmah-dynamodb,代码行数:12,代码来源:DynamoErrorLog.cs

示例8: Accept

		public bool Accept(String name, IDictionary options, TextWriter writer)
		{
			if (!"project".Equals(name))
			{
				return false;
			}
			else if (options.Count == 1)
			{
				writer.WriteLine("Creates a new VS.Net 2003 project structure");
				writer.WriteLine("");
				writer.WriteLine("name     : Project name");
				writer.WriteLine("outdir   : Target directory (must exists)");
				writer.WriteLine("windsor  : [Optional] Enable WindsorContainer Integration");
				writer.WriteLine("view     : [Optional] aspnet|nvelocity (defaults to nvelocity)");
				writer.WriteLine("lang     : [Optional] c#|vb.net (defaults to c#)");
				writer.WriteLine("");
				writer.WriteLine("Example:");
				writer.WriteLine("");
				writer.WriteLine(@"> generator project name:My.CoR.Project windsor outdir:c:\temp");
				writer.WriteLine("");

				return false;
			}
			else if (!options.Contains("outdir"))
			{
				writer.WriteLine("outdir must be specified");
				
				return false;
			}
			else if (!options.Contains("name"))
			{
				writer.WriteLine("name must be specified");
				
				return false;
			}
			else 
			{
				DirectoryInfo info = new DirectoryInfo(options["outdir"] as String);

				if (!info.Exists)
				{
					// info.Create(); // Is it safe to use it?
					writer.WriteLine("Error: The specified outdir does not exists.");

					return false;
				}
			}

			return true;
		}
开发者ID:ralescano,项目名称:castle,代码行数:50,代码来源:ProjectGenerator.cs

示例9: GetScaleMeters

 private static double GetScaleMeters(IDictionary source, string key, IFactory factory)
 {
     var lengthMeters = Node.Net.Factories.Extension.IDictionaryExtension.GetLengthMeters(source, key);
     if (source.Contains(key)) return lengthMeters;
     if (key.Contains(","))
     {
         var keys = key.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
         foreach (var k in keys)
         {
             if (source.Contains(k)) return lengthMeters;
         }
     }
     return 1;
 }
开发者ID:node-net,项目名称:Node.Net,代码行数:14,代码来源:IScaleHelper.cs

示例10: Convert

 public IDictionary Convert(IDictionary source)
 {
     if (source != null && source.Contains(nameof(Type)))
     {
         var type = source[nameof(Type)].ToString();
         if (Types != null && Types.ContainsKey(type))
         {
             try
             {
                 var _type = Types[type];
                 if (_type == null) throw new Exception($"Types['{type}'] was null");
                 var dictionary = Activator.CreateInstance(_type) as IDictionary;
                 if(dictionary == null)
                 {
                     throw new Exception($"unable to create instance of type {_type.FullName}");
                 }
                 Copy(source, dictionary);
                 return dictionary;
             }
             catch(Exception ex)
             {
                 throw new Exception($"Exception while converting type '{type}', fullname {Types[type].FullName}", ex);
             }
         }
         
     }
     if(source != null)
     {
         var result = Activator.CreateInstance(source.GetType()) as IDictionary;
         Copy(source, result);
         return result;
     }
     return source;
 }
开发者ID:node-net,项目名称:Node.Net,代码行数:34,代码来源:DictionaryTypeConverter.cs

示例11: AddRemoveCorrelationToken

 private void AddRemoveCorrelationToken(Type interfaceType, IDictionary properties, object corrRefProperty)
 {
     if (interfaceType != null)
     {
         object[] corrProvAttribs = interfaceType.GetCustomAttributes(typeof(CorrelationProviderAttribute), false);
         object[] corrParamAttribs = interfaceType.GetCustomAttributes(typeof(CorrelationParameterAttribute), false);
         if (corrProvAttribs.Length != 0 || corrParamAttribs.Length != 0)
         {
             if (!properties.Contains("CorrelationToken"))
                 properties.Add("CorrelationToken", corrRefProperty);
             return;
         }
     }
     if (properties.Contains("CorrelationToken"))
         properties.Remove("CorrelationToken");
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:16,代码来源:EventSinkActivityDesigner.cs

示例12: GetRestActionName

		public static string GetRestActionName(string action, IDictionary actions, string httpMethod)
		{
			if (IsCollectionAction(action))
			{
				switch (httpMethod.ToUpper())
				{
					case "GET":
						return "Index";						
					case "POST":
						return "Create";
				}
			}

			if (IsNewAction(action))
			{
				return "New";
			}

			if (!actions.Contains(action))
			{
				switch (httpMethod.ToUpper())
				{
					case "GET":
						return "Show";
					case "PUT":
						return "Update";
					case "DELETE":
						return "Destroy";						
				}
			}

			return null;
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:33,代码来源:ActionSelector.cs

示例13: SendNew

        public static void SendNew(String to, String body, String Subject, String hetType, IDictionary replacements = null)
        {
            init();
            if (replacements.Contains("%webkey%"))
            {
                replacements.Remove("%webkey%");
            }

            // Webkey aanmaken
            String key;
            key = stored.NewWebkey(to);

            // In database is het leraar, in de webview docent (freakytime aanpassing)
            String webkeyType = "student";
            if (hetType.Equals("docent"))
            {
                webkeyType = "leraar";
            }

            webkeys webkey = new webkeys() { webkey = key, type = webkeyType, email = to };

            // Webkey opslaan in database
            WStored.StageManagerEntities.webkeys.Add(webkey);
            WStored.PushToDB();

            // construct URL
            key = "http://stagemanager.modupro.nl/" + hetType + "/" + webkey.webkey;
            replacements.Add("%webkey%", "<a href='" + key + "'>" + key + "</a>");

            // Send
            Send(to, body, Subject, replacements);
        }
开发者ID:eihi,项目名称:StageBeheerder,代码行数:32,代码来源:Mailer.cs

示例14: Contains

 public void Contains(IDictionary dic)
 {
     foreach (DictionaryEntry de in dic)
     {
         bool b = dic.Contains(de.Key);
     }
 }
开发者ID:Orcomp,项目名称:NPerf,代码行数:7,代码来源:ContainsDictionaryTester.cs

示例15: SendNew

        public static void SendNew(String to, String body, String Subject, IDictionary replacements = null)
        {
            init();
            if (replacements.Contains("%webkey%"))
            {
                replacements.Remove("%webkey%");
            }
            String webkey;
            webkey = stored.NewWebkey(to);
            WWebkey key = new WWebkey(new webkeysets() { ConnectionKey = webkey, Status="actief" });
            key.add(key.getSet());

            System.Reflection.Assembly thisExe = System.Reflection.Assembly.GetExecutingAssembly();
            string path = thisExe.Location;
            DirectoryInfo dirinfo = new DirectoryInfo(path);
            string folderName = dirinfo.Parent.FullName;
            path = folderName + "\\Config.txt";
            Uri uri = new Uri(path);
            String s = File.ReadAllText(uri.AbsolutePath);
            String[] split = { "server: " };
            String[] server = s.Split(split, StringSplitOptions.RemoveEmptyEntries);
            webkey = server[0] + webkey;
            replacements.Add("%webkey%", "<a href='" + webkey + "'>" + webkey + "</a>");
            Send(to, body, Subject, replacements);
        }
开发者ID:eye2web,项目名称:StageManager,代码行数:25,代码来源:Mailer.cs


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