static int _CreateSystem_Collections_Generic_KeyValuePair_int_TestAccount(IntPtr L)
	{
		int count = LuaDLL.lua_gettop(L);

		if (count == 2)
		{
			int arg0 = (int)LuaDLL.luaL_checknumber(L, 1);
			TestAccount arg1 = (TestAccount)ToLua.CheckObject(L, 2, typeof(TestAccount));
			System.Collections.Generic.KeyValuePair<int,TestAccount> obj = new System.Collections.Generic.KeyValuePair<int,TestAccount>(arg0, arg1);
			ToLua.PushValue(L, obj);
			return 1;
		}
		else if (count == 0)
		{
			System.Collections.Generic.KeyValuePair<int,TestAccount> obj = new System.Collections.Generic.KeyValuePair<int,TestAccount>();
			ToLua.PushValue(L, obj);
			return 1;
		}
		else
		{
			LuaDLL.luaL_error(L, "invalid arguments to method: System.Collections.Generic.KeyValuePair<int,TestAccount>.New");
		}

		return 0;
	}
Exemple #2
0
        public void ContainsKeyValuePair()
        {
            var kvp = new System.Collections.Generic.KeyValuePair<int, string>(1, "dog");
            var result = dictionary.Contains(kvp);

            Assert.IsTrue(result);
        }
Exemple #3
0
        public void AddKeyValuePair()
        {
            var kvp = new System.Collections.Generic.KeyValuePair<int, string>(4, "value");
            dictionary.Add(kvp);

            Assert.AreEqual(4, dictionary.Count);
            Assert.AreEqual("value", dictionary[4]);
        }
 public void It_handles_timespans()
 {
     var retriever = new TimeSpanValueRetriever();
     var empty = new System.Collections.Generic.KeyValuePair<string, string>();
     retriever.CanRetrieve(empty, null, typeof(System.TimeSpan)).Should().BeTrue();
     retriever.CanRetrieve(empty, null, typeof(System.String)).Should().BeFalse();
     retriever.CanRetrieve(empty, null, typeof(System.Boolean)).Should().BeFalse();
 }
Exemple #5
0
        public void CopyTo()
        {
            var targetArray = new System.Collections.Generic.KeyValuePair<int, string>[5];

            var a = 2;
            var b = a + dictionary.Count - 1;
            dictionary.CopyTo(targetArray, a);

            Assert.IsTrue(dictionary.All(x => InRange(a, b, targetArray.ToList().IndexOf(x))));
        }
Exemple #6
0
        public void RemoveOnKey()
        {
            var kvp = new System.Collections.Generic.KeyValuePair<int, string>(1, "dog");
            dictionary.Remove(kvp);

            Assert.AreEqual(2, dictionary.Count);
        }
Exemple #7
0
 void System.Collections.Generic.ICollection <System.Collections.Generic.KeyValuePair <object, object?> > .Add(System.Collections.Generic.KeyValuePair <object, object?> item)
 {
 }
Exemple #8
0
 public bool TryRemove(System.Collections.Generic.KeyValuePair <TKey, TValue> item)
 {
     throw null;
 }
 bool System.Collections.Generic.ICollection <System.Collections.Generic.KeyValuePair <System.String, System.Object> > .Contains(System.Collections.Generic.KeyValuePair <string, object> item)
 {
     throw null;
 }
Exemple #10
0
        static void WriteBackInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain, StackObject *ptr_of_this_method, IList <object> __mStack, ref System.Collections.Generic.KeyValuePair <System.String, System.Collections.Generic.List <EB.Sparx.ChatMessage> > instance_of_this_method)
        {
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            switch (ptr_of_this_method->ObjectType)
            {
            case ObjectTypes.Object:
            {
                __mStack[ptr_of_this_method->Value] = instance_of_this_method;
            }
            break;

            case ObjectTypes.FieldReference:
            {
                var ___obj = __mStack[ptr_of_this_method->Value];
                if (___obj is ILTypeInstance)
                {
                    ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = instance_of_this_method;
                }
                else
                {
                    var t = __domain.GetType(___obj.GetType()) as CLRType;
                    t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, instance_of_this_method);
                }
            }
            break;

            case ObjectTypes.StaticFieldReference:
            {
                var t = __domain.GetType(ptr_of_this_method->Value);
                if (t is ILType)
                {
                    ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = instance_of_this_method;
                }
                else
                {
                    ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, instance_of_this_method);
                }
            }
            break;

            case ObjectTypes.ArrayReference:
            {
                var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as System.Collections.Generic.KeyValuePair <System.String, System.Collections.Generic.List <EB.Sparx.ChatMessage> >[];
                instance_of_arrayReference[ptr_of_this_method->ValueLow] = instance_of_this_method;
            }
            break;
            }
        }
Exemple #11
0
 void System.Collections.Generic.ICollection <System.Collections.Generic.KeyValuePair <TKey, TValue> > .Add(System.Collections.Generic.KeyValuePair <TKey, TValue> keyValuePair)
 {
 }
Exemple #12
0
 bool System.Collections.Generic.ICollection <System.Collections.Generic.KeyValuePair <TKey, TValue> > .Remove(System.Collections.Generic.KeyValuePair <TKey, TValue> item)
 {
     return(default(bool));
 }
        public static async Task VerifyReceivedC2DMessageAsync(Client.TransportType transport, DeviceClient dc, string deviceId, string payload, string p1Value)
        {
            var  sw       = new Stopwatch();
            bool received = false;

            sw.Start();


            while (!received && sw.ElapsedMilliseconds < FaultInjection.RecoveryTimeMilliseconds)
            {
                Client.Message receivedMessage = null;

                try
                {
                    s_log.WriteLine($"Receiving messages for device {deviceId}.");

                    if (transport == Client.TransportType.Http1)
                    {
                        // timeout on HTTP is not supported
                        receivedMessage = await dc.ReceiveAsync().ConfigureAwait(false);
                    }
                    else
                    {
                        receivedMessage = await dc.ReceiveAsync(s_oneMinute).ConfigureAwait(false);
                    }

                    if (receivedMessage == null)
                    {
                        Assert.Fail($"No message is received for device {deviceId} in {s_oneMinute}.");
                    }

                    try
                    {
                        // always complete message
                        await dc.CompleteAsync(receivedMessage).ConfigureAwait(false);
                    }
                    catch (Exception)
                    {
                        // ignore exception from CompleteAsync
                    }

                    string messageData = Encoding.ASCII.GetString(receivedMessage.GetBytes());
                    s_log.WriteLine($"{nameof(VerifyReceivedC2DMessageAsync)}: Received message: for {deviceId}: {messageData}");
                    if (Equals(payload, messageData))
                    {
                        Assert.AreEqual(1, receivedMessage.Properties.Count, $"The count of received properties did not match for device {deviceId}");
                        System.Collections.Generic.KeyValuePair <string, string> prop = receivedMessage.Properties.Single();
                        Assert.AreEqual("property1", prop.Key, $"The key \"property1\" did not match for device {deviceId}");
                        Assert.AreEqual(p1Value, prop.Value, $"The value of \"property1\" did not match for device {deviceId}");
                        received = true;
                    }
                }
                finally
                {
                    receivedMessage?.Dispose();
                }
            }

            sw.Stop();
            Assert.IsTrue(received, $"No message received for device {deviceId} with payload={payload} in {FaultInjection.RecoveryTimeMilliseconds}.");
        }
Exemple #14
0
        void m_ZoneLayerSelector_OnItemSelect(System.Collections.Generic.KeyValuePair <Guid, string> e)
        {
            m_TargetLayerGuid = e.Key;

            IsEnabled = true;
        }
Exemple #15
0
        static int _m_First(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                DCET.Model.MultiMapSet <string, string> gen_to_be_invoked = (DCET.Model.MultiMapSet <string, string>)translator.FastGetCSObj(L, 1);



                {
                    System.Collections.Generic.KeyValuePair <string, System.Collections.Generic.HashSet <string> > gen_ret = gen_to_be_invoked.First(  );
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
 private void WriteThread()
 {
     while (true)
     {
         if (queueOutgoing.Count > 0)
         {
             System.Collections.Generic.KeyValuePair <IPEndPoint, byte[]> message = queueOutgoing.Dequeue();
             if (tcpClients.Count > 0)
             {
                 try
                 {
                     foreach (TcpClient client in tcpClients)
                     {
                         try
                         {
                             if (!client.Connected)
                             {
                                 DeadClient(client);
                                 continue;
                             }
                             if (Switching)
                             {
                                 if ((IPEndPoint)client.Client.RemoteEndPoint != message.Key)
                                 {
                                     try
                                     {
                                         NetworkStream ns = client.GetStream();
                                         ns.Write(message.Value, 0, message.Value.Length);
                                     }
                                     catch
                                     {
                                         DeadClient(client);
                                     }
                                 }
                             }
                             else
                             {
                                 try
                                 {
                                     if (message.Key == null)
                                     {
                                         NetworkStream ns = client.GetStream();
                                         ns.Write(message.Value, 0, message.Value.Length);
                                     }
                                     else if ((IPEndPoint)client.Client.RemoteEndPoint == message.Key)
                                     {
                                         NetworkStream ns = client.GetStream();
                                         ns.Write(message.Value, 0, message.Value.Length);
                                     }
                                 }
                                 catch
                                 {
                                     DeadClient(client);
                                 }
                             }
                         }
                         catch { }
                     }
                 }
                 catch { }
             }
         }
         Thread.Sleep(5);
     }
 }
Exemple #17
0
        static StackObject *get_Key_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            System.Collections.Generic.KeyValuePair <System.Int64, System.Collections.Generic.List <ILRuntime.Runtime.Intepreter.ILTypeInstance> > instance_of_this_method = (System.Collections.Generic.KeyValuePair <System.Int64, System.Collections.Generic.List <ILRuntime.Runtime.Intepreter.ILTypeInstance> >) typeof(System.Collections.Generic.KeyValuePair <System.Int64, System.Collections.Generic.List <ILRuntime.Runtime.Intepreter.ILTypeInstance> >).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 16);

            var result_of_this_method = instance_of_this_method.Key;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);

            __intp.Free(ptr_of_this_method);
            __ret->ObjectType      = ObjectTypes.Long;
            *(long *)&__ret->Value = result_of_this_method;
            return(__ret + 1);
        }
Exemple #18
0
        public void CopyToException()
        {
            var array = new System.Collections.Generic.KeyValuePair <int, string> [5];

            dictionary.CopyTo(array, 4);
        }
        private void TransformParticleSystem(ParticleSystem particles, Camera camera, Vector2 initialStartSpeed, System.Collections.Generic.KeyValuePair <Vector3, Vector3> initialStartSize)
        {
            if (particles == null)
            {
                return;
            }
            Transform anchor = camera.transform;

            particles.transform.position   = new Vector3(anchor.position.x, anchor.position.y + camera.orthographicSize + yOffset, particles.transform.position.z);
            particles.transform.localScale = new Vector3(visibleWorldWidth * WidthMultiplier, 1.0f, 1.0f);
            var m = particles.main;

            m.simulationSpace       = ParticleSystemSimulationSpace.Custom;
            m.customSimulationSpace = transform;
            var startSpeed = m.startSpeed;

            startSpeed.constantMin = initialStartSpeed.x * cameraMultiplier;
            startSpeed.constantMax = initialStartSpeed.y * cameraMultiplier;
            var startSizeX = m.startSizeX;

            startSizeX.constantMin = initialStartSize.Key.x * cameraMultiplier;
            startSizeX.constantMax = initialStartSize.Value.x * cameraMultiplier;
            var startSizeY = m.startSizeY;

            startSizeY.constantMin = initialStartSize.Key.y * cameraMultiplier;
            startSizeY.constantMax = initialStartSize.Value.y * cameraMultiplier;
            var startSizeZ = m.startSizeZ;

            startSizeZ.constantMin = initialStartSize.Key.z * cameraMultiplier;
            startSizeZ.constantMax = initialStartSize.Value.z * cameraMultiplier;
            m.startSpeed           = startSpeed;
            m.startSizeX           = startSizeX;
            m.startSizeY           = startSizeY;
            m.startSizeZ           = startSizeZ;
        }
Exemple #20
0
 protected abstract void SetObstructionOcclusion(
     System.Collections.Generic.KeyValuePair <AkAudioListener, ObstructionOcclusionValue> ObsOccPair);
Exemple #21
0
 public System.Int32 Compare(System.Collections.Generic.KeyValuePair <ILRuntime.Runtime.GeneratedAdapter.IComparable_1_ILTypeInstanceAdapter.Adapter, ILRuntime.Runtime.Intepreter.ILTypeInstance> x, System.Collections.Generic.KeyValuePair <ILRuntime.Runtime.GeneratedAdapter.IComparable_1_ILTypeInstanceAdapter.Adapter, ILRuntime.Runtime.Intepreter.ILTypeInstance> y)
 {
     if (!mCompare_0_Got)
     {
         mCompare_0     = instance.Type.GetMethod("Compare", 2);
         mCompare_0_Got = true;
     }
     return((System.Int32)appdomain.Invoke(mCompare_0, this.instance, x, y));
 }
Exemple #22
0
 public void Add(System.Collections.Generic.KeyValuePair <string, System.Json.JsonValue> pair)
 {
 }
        static StackObject *get_Key_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            System.Collections.Generic.KeyValuePair <System.String, ILRuntime.Runtime.Intepreter.ILTypeInstance> instance_of_this_method = (System.Collections.Generic.KeyValuePair <System.String, ILRuntime.Runtime.Intepreter.ILTypeInstance>) typeof(System.Collections.Generic.KeyValuePair <System.String, ILRuntime.Runtime.Intepreter.ILTypeInstance>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));

            var result_of_this_method = instance_of_this_method.Key;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);

            __intp.Free(ptr_of_this_method);
            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Exemple #24
0
 bool System.Collections.Generic.ICollection <System.Collections.Generic.KeyValuePair <System.String, System.Json.JsonValue> > .Remove(System.Collections.Generic.KeyValuePair <string, System.Json.JsonValue> item)
 {
     throw null;
 }
Exemple #25
0
        static StackObject *get_Value_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            System.Collections.Generic.KeyValuePair <System.String, System.Collections.Generic.List <EB.Sparx.ChatMessage> > instance_of_this_method = (System.Collections.Generic.KeyValuePair <System.String, System.Collections.Generic.List <EB.Sparx.ChatMessage> >) typeof(System.Collections.Generic.KeyValuePair <System.String, System.Collections.Generic.List <EB.Sparx.ChatMessage> >).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));

            var result_of_this_method = instance_of_this_method.Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);

            __intp.Free(ptr_of_this_method);
            object obj_result_of_this_method = result_of_this_method;

            if (obj_result_of_this_method is CrossBindingAdaptorType)
            {
                return(ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance));
            }
            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Exemple #26
0
        object ReadCore()
        {
            SkipSpaces();
            int c = PeekChar();

            if (c < 0)
            {
                throw JsonError("Incomplete JSON input");
            }
            switch (c)
            {
            case '[':
                ReadChar();
                System.Collections.Generic.List <object> list = new System.Collections.Generic.List <object>();
                SkipSpaces();
                if (PeekChar() == ']')
                {
                    ReadChar();
                    return(list);
                }
                while (true)
                {
                    list.Add(ReadCore());
                    SkipSpaces();
                    c = PeekChar();
                    if (c != ',')
                    {
                        break;
                    }
                    ReadChar();
                    continue;
                }
                if (ReadChar() != ']')
                {
                    throw JsonError("JSON array must end with ']'");
                }
                return(list.ToArray());

            case '{':
                ReadChar();
                System.Collections.Generic.Dictionary <string, object> obj = new System.Collections.Generic.Dictionary <string, object>();
                SkipSpaces();
                if (PeekChar() == '}')
                {
                    ReadChar();
                    return(obj);
                }
                while (true)
                {
                    SkipSpaces();
                    if (PeekChar() == '}')
                    {
                        ReadChar();
                        break;
                    }
                    string name = ReadStringLiteral();
                    SkipSpaces();
                    Expect(':');
                    SkipSpaces();
                    obj [name] = ReadCore();                      // it does not reject duplicate names.
                    SkipSpaces();
                    c = ReadChar();
                    if (c == ',')
                    {
                        continue;
                    }
                    if (c == '}')
                    {
                        break;
                    }
                }

                int idx = 0;
                System.Collections.Generic.KeyValuePair <string, object> [] ret =
                    new System.Collections.Generic.KeyValuePair <string, object> [obj.Count];
                foreach (System.Collections.Generic.KeyValuePair <string, object> kvp in obj)
                {
                    ret [idx++] = kvp;
                }

                return(ret);

            case 't':
                Expect("true");
                return(true);

            case 'f':
                Expect("false");
                return(false);

            case 'n':
                Expect("null");
                // FIXME: what should we return?
                return((string)null);

            case '"':
                return(ReadStringLiteral());

            default:
                if ('0' <= c && c <= '9' || c == '-')
                {
                    return(ReadNumericLiteral());
                }
                else
                {
                    throw JsonError(string.Format("Unexpected character '{0}'", (char)c));
                }
            }
        }
Exemple #27
0
 bool System.Collections.Generic.ICollection <System.Collections.Generic.KeyValuePair <TKey, TValue> > .Remove(System.Collections.Generic.KeyValuePair <TKey, TValue> keyValuePair)
 {
     throw null;
 }
 public void Add(System.Collections.Generic.KeyValuePair <string, object?> item)
 {
     throw null;
 }
 void System.Collections.Generic.ICollection <System.Collections.Generic.KeyValuePair <System.String, System.Object> > .Add(System.Collections.Generic.KeyValuePair <string, object> item)
 {
 }
Exemple #30
0
        public void CopyToException()
        {
            var array = new System.Collections.Generic.KeyValuePair<int, string>[5];

            dictionary.CopyTo(array, 4);
        }
Exemple #31
0
 public void GetEnumerator()
 {
     foreach (var kvp in dictionary)
         Assert.AreEqual(keys.ToList().IndexOf(kvp.Key), values.ToList().IndexOf(kvp.Value));
     for (int i = 0; i < keys.Length; i++)
     {
         var kvp = new System.Collections.Generic.KeyValuePair<int, string>(keys[i], values[i]);
         Assert.IsTrue(dictionary.Contains(kvp));
     }
 }
 bool System.Collections.Generic.ICollection <System.Collections.Generic.KeyValuePair <TKey, TValue> > .Contains(System.Collections.Generic.KeyValuePair <TKey, TValue> item)
 {
     throw null;
 }
Exemple #33
0
 bool System.Collections.Generic.ICollection <System.Collections.Generic.KeyValuePair <object, object?> > .Contains(System.Collections.Generic.KeyValuePair <object, object?> item)
 {
     throw null;
 }
Exemple #34
0
        public static void Process_Environment()
        {
            ProcessStartInfo psi = new ProcessStartInfo();

            // Creating a detached ProcessStartInfo will pre-populate the environment
            // with current environmental variables. 

            // When used with an existing Process.ProcessStartInfo the following behavior
            //  * Desktop - Populates with current EnvironmentVariable
            //  * Project K - Does NOT pre-populate environment.

            var Environment2 = psi.Environment;

            Assert.NotEqual(Environment2.Count, 0);

            int CountItems = Environment2.Count;

            Environment2.Add("NewKey", "NewValue");
            Environment2.Add("NewKey2", "NewValue2");

            Assert.Equal(CountItems + 2, Environment2.Count);
            Environment2.Remove("NewKey");
            Assert.Equal(CountItems + 1, Environment2.Count);

            //Exception not thrown with invalid key
            Assert.Throws<ArgumentException>(() => { Environment2.Add("NewKey2", "NewValue2"); });

            //Clear
            Environment2.Clear();
            Assert.Equal(0, Environment2.Count);

            //ContainsKey 
            Environment2.Add("NewKey", "NewValue");
            Environment2.Add("NewKey2", "NewValue2");
            Assert.True(Environment2.ContainsKey("NewKey"));
            Assert.False(Environment2.ContainsKey("NewKey99"));

            //Iterating
            string result = null;
            int index = 0;
            foreach (string e1 in Environment2.Values)
            {
                index++;
                result += e1;
            }
            Assert.Equal(2, index);
            Assert.Equal("NewValueNewValue2", result);

            result = null;
            index = 0;
            foreach (string e1 in Environment2.Keys)
            {
                index++;
                result += e1;
            }
            Assert.Equal("NewKeyNewKey2", result);
            Assert.Equal(2, index);

            result = null;
            index = 0;
            foreach (System.Collections.Generic.KeyValuePair<string, string> e1 in Environment2)
            {
                index++;
                result += e1.Key;
            }
            Assert.Equal("NewKeyNewKey2", result);
            Assert.Equal(2, index);

            //Contains
            Assert.True(Environment2.Contains(new System.Collections.Generic.KeyValuePair<string, string>("NewKey", "NewValue")));
            Assert.False(Environment2.Contains(new System.Collections.Generic.KeyValuePair<string, string>("NewKey99", "NewValue99")));

            //Exception not thrown with invalid key
            Assert.Throws<ArgumentNullException>(() =>
            {
                Environment2.Contains(new System.Collections.Generic.KeyValuePair<string, string>(null, "NewValue99"));
            }
            );

            Environment2.Add(new System.Collections.Generic.KeyValuePair<string, string>("NewKey98", "NewValue98"));

            //Indexed
            string newIndexItem = Environment2["NewKey98"];
            Assert.Equal("NewValue98", newIndexItem);

            //TryGetValue
            string stringout = null;
            bool retval = false;
            retval = Environment2.TryGetValue("NewKey", out stringout);
            Assert.Equal("NewValue", stringout);
            Assert.True(retval);

            stringout = null;
            retval = false;
            retval = Environment2.TryGetValue("NewKey99", out stringout);
            Assert.Equal(null, stringout);
            Assert.False(retval);

            //Exception not thrown with invalid key
            Assert.Throws<ArgumentNullException>(() =>
            {
                string stringout1 = null;
                bool retval1 = false;
                retval1 = Environment2.TryGetValue(null, out stringout1);
            }
            );

            //Exception not thrown with invalid key
            Assert.Throws<ArgumentNullException>(() =>
            {
                Environment2.Add(null, "NewValue2");
            }
            );

            //Invalid Key to add
            Assert.Throws<ArgumentException>(() =>
            {
                Environment2.Add("NewKey2", "NewValue2");
            }
            );
            //Remove Item
            Environment2.Remove("NewKey98");
            Environment2.Remove("NewKey98");   //2nd occurence should not assert

            //Exception not thrown with null key
            Assert.Throws<ArgumentNullException>(() => { Environment2.Remove(null); });

            //"Exception not thrown with null key"
            Assert.Throws<System.Collections.Generic.KeyNotFoundException>(() => { string a1 = Environment2["1bB"]; });

            Assert.True(Environment2.Contains(new System.Collections.Generic.KeyValuePair<string, string>("NewKey2", "NewValue2")));
            Assert.False(Environment2.Contains(new System.Collections.Generic.KeyValuePair<string, string>("newkey2", "NewValue2")));
            Assert.False(Environment2.Contains(new System.Collections.Generic.KeyValuePair<string, string>("NewKey2", "newvalue2")));
            Assert.False(Environment2.Contains(new System.Collections.Generic.KeyValuePair<string, string>("newkey2", "newvalue2")));

            //Use KeyValuePair Enumerator
            var x = Environment2.GetEnumerator();
            x.MoveNext();
            var y1 = x.Current;
            Assert.Equal("NewKey NewValue", y1.Key + " " + y1.Value);
            x.MoveNext();
            y1 = x.Current;
            Assert.Equal("NewKey2 NewValue2", y1.Key + " " + y1.Value);

            //IsReadonly
            Assert.False(Environment2.IsReadOnly);

            Environment2.Add(new System.Collections.Generic.KeyValuePair<string, string>("NewKey3", "NewValue3"));
            Environment2.Add(new System.Collections.Generic.KeyValuePair<string, string>("NewKey4", "NewValue4"));


            //CopyTo
            System.Collections.Generic.KeyValuePair<String, String>[] kvpa = new System.Collections.Generic.KeyValuePair<string, string>[10];
            Environment2.CopyTo(kvpa, 0);
            Assert.Equal("NewKey", kvpa[0].Key);
            Assert.Equal("NewKey3", kvpa[2].Key);

            Environment2.CopyTo(kvpa, 6);
            Assert.Equal("NewKey", kvpa[6].Key);

            //Exception not thrown with null key
            Assert.Throws<System.ArgumentOutOfRangeException>(() => { Environment2.CopyTo(kvpa, -1); });

            //Exception not thrown with null key
            Assert.Throws<System.ArgumentException>(() => { Environment2.CopyTo(kvpa, 9); });

            //Exception not thrown with null key
            Assert.Throws<System.ArgumentNullException>(() =>
            {
                System.Collections.Generic.KeyValuePair<String, String>[] kvpanull = null;
                Environment2.CopyTo(kvpanull, 0);
            }
            );
        }
 public bool Remove(System.Collections.Generic.KeyValuePair <string, object?> item)
 {
     throw null;
 }
Exemple #36
0
        /// <summary>
        /// this is triggered on selecting the treeview items and assigned to  local variable
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void trProfiles_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            var lt = e.NewValue;

            System.Collections.Generic.KeyValuePair <string, System.Collections.Generic.List <ProfileNames> > ls = (System.Collections.Generic.KeyValuePair <string, System.Collections.Generic.List <ProfileNames> >)lt;

            selectedPfname = ls.Key;
        }
		public static IPagedDataService<Photo> GetGroupPhotosPagedDataService(Group group)
		{
			var orderBy = new System.Collections.Generic.KeyValuePair<object, Bobs.OrderBy.OrderDirection>
				(GroupPhoto.Columns.DateTime, OrderBy.OrderDirection.Descending);
			return group.ChildPhotos(new Q(Photo.Columns.IsInCaptionCompetition, false), orderBy);
		}
Exemple #38
0
 bool System.Collections.Generic.ICollection <System.Collections.Generic.KeyValuePair <System.Object, System.Object> > .Remove(System.Collections.Generic.KeyValuePair <object, object> item)
 {
     throw null;
 }
 public override void OnDblClick()
 {
     if (pFeature != null)
     {
         var AnnoLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_AnnotationXZZ) as IFeatureLayer;//ע��ͼ��
         if (AnnoLayer == null)
         {
             return;
         }
         string bid = pFeature.get_Value(pFeature.Fields.FindField("bid")).ToString();
         Form.Text="�޸�С��״";
         Form.Tag=bid;
         IFeatureClass pFeatureClass = AnnoLayer.FeatureClass;
         IQueryFilter pFilter = new QueryFilterClass();
         pFilter.WhereClause = "bid='"+bid+"'";
         IFeatureCursor pCursor = pFeatureClass.Search(pFilter, false);
         IFeature mFeature = pCursor.NextFeature();
         int k = 0;
         int count = pFeatureClass.FeatureCount(pFilter);
         System.Collections.Generic.KeyValuePair<int, string>[] listobj = new System.Collections.Generic.KeyValuePair<int, string>[count];
         while (mFeature != null)
         {
             if (k == 0)
             {
                 Form.txtAngle.Text = mFeature.get_Value(mFeature.Fields.FindField("strAngle")).ToString();
                 Form.txtBlc.Text = mFeature.get_Value(mFeature.Fields.FindField("strScale")).ToString();
                 Form.txtX.Text = mFeature.get_Value(mFeature.Fields.FindField("strX")).ToString();
                 Form.txtY.Text = mFeature.get_Value(mFeature.Fields.FindField("strY")).ToString();
             }
             int index=Convert.ToInt32(mFeature.get_Value(mFeature.Fields.FindField("strIndex")).ToString());
             int type=Convert.ToInt32(mFeature.get_Value(mFeature.Fields.FindField("strType")).ToString());
             string str=mFeature.get_Value(mFeature.Fields.FindField("TextString")).ToString();
             listobj[index - 1] = new System.Collections.Generic.KeyValuePair<int, string>(type,str);
             mFeature = pCursor.NextFeature();
             k++;
         }
         if (listobj.Length > 0)
         {
             Form.dgrdvZhzzt.RowCount = listobj.Length;
             for (int i = 0; i < listobj.Length - 1; i++)
             {
                 Form.dgrdvZhzzt.Rows[i].Cells[0].Value = listobj[i].Value;
                 DataGridViewComboBoxCell cell = Form.dgrdvZhzzt.Rows[i].Cells[1] as DataGridViewComboBoxCell;
                 if (listobj[i].Key == 0)
                     cell.Value = "�Ҳ�";
                 else
                     cell.Value = "ú��";
             }
             Form.txtDBBG.Text = listobj[listobj.Length - 1].Value;
         }
     }
 }
Exemple #40
0
 public void Add(System.Collections.Generic.KeyValuePair <string, Microsoft.Extensions.Primitives.StringValues> item)
 {
 }
Exemple #41
0
 public TaskArgs(System.Collections.Generic.KeyValuePair<string, Task> keyValue)
 {
     // TODO: Complete member initialization
     this.Task = keyValue;
 }
Exemple #42
0
 public bool Remove(System.Collections.Generic.KeyValuePair <string, Microsoft.Extensions.Primitives.StringValues> item)
 {
     throw null;
 }