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


C# THashSet.Add方法代码示例

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


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

示例1: AddExprerience

 public static void AddExprerience(GameUser user, int experience)
 {
     string userID = user.UserID;
     var userEmbattleList = new GameDataCacheSet<UserEmbattle>().FindAll(userID, m => m.MagicID == user.UseMagicID);
     THashSet<int> generalHash = new THashSet<int>();
     foreach (UserEmbattle userEmbattle in userEmbattleList)
     {
         //wuzf 8-18 修复多个相同佣兵阵形数据
         if (generalHash.Contains(userEmbattle.GeneralID))
         {
             userEmbattle.GeneralID = 0;
             //userEmbattle.Update();
             continue;
         }
         else
         {
             generalHash.Add(userEmbattle.GeneralID);
         }
         //UserGeneral userGeneral = new GameDataCacheSet<UserGeneral>().FindKey(userID, userEmbattle.GeneralID);
         //if (userGeneral != null)
         //{
         //    userGeneral.CurrExperience = MathUtils.Addition(userGeneral.CurrExperience, experience);
         //}
     }
     //UserHelper.UserGeneralExp(user.UserID, experience);
 }
开发者ID:rongxiong,项目名称:Scut,代码行数:26,代码来源:PlotHelper.cs

示例2: Read

 public void Read (TProtocol iprot)
 {
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 1:
         if (field.Type == TType.Set) {
           {
             KeysOnly = new THashSet<string>();
             TSet _set8 = iprot.ReadSetBegin();
             for( int _i9 = 0; _i9 < _set8.Count; ++_i9)
             {
               string _elem10 = null;
               _elem10 = iprot.ReadString();
               KeysOnly.Add(_elem10);
             }
             iprot.ReadSetEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.Map) {
           {
             FullMap = new Dictionary<string, string>();
             TMap _map11 = iprot.ReadMapBegin();
             for( int _i12 = 0; _i12 < _map11.Count; ++_i12)
             {
               string _key13;
               string _val14;
               _key13 = iprot.ReadString();
               _val14 = iprot.ReadString();
               FullMap[_key13] = _val14;
             }
             iprot.ReadMapEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }
开发者ID:Glympse,项目名称:evernote-sdk-csharp,代码行数:56,代码来源:LazyMap.cs

示例3: Read

 public void Read (TProtocol iprot)
 {
   bool isset_node = false;
   bool isset_port = false;
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 1:
         if (field.Type == TType.String) {
           Node = iprot.ReadString();
           isset_node = true;
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.Set) {
           {
             Port = new THashSet<long>();
             TSet _set181 = iprot.ReadSetBegin();
             for( int _i182 = 0; _i182 < _set181.Count; ++_i182)
             {
               long _elem183;
               _elem183 = iprot.ReadI64();
               Port.Add(_elem183);
             }
             iprot.ReadSetEnd();
           }
           isset_port = true;
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
   if (!isset_node)
     throw new TProtocolException(TProtocolException.INVALID_DATA);
   if (!isset_port)
     throw new TProtocolException(TProtocolException.INVALID_DATA);
 }
开发者ID:bcardi,项目名称:storm-net-adapter,代码行数:52,代码来源:NodeInfo.cs

示例4: ClientTest


//.........这里部分代码省略.........
                if (first)
                {
                    first = false;
                }
                else
                {
                    Console.Write(", ");
                }
                Console.Write(key + " => " + mapout[key]);
            }
            Console.Write("})");

            Dictionary<int, int> mapin = client.testMap(mapout);

            Console.Write(" = {");
            first = true;
            foreach (int key in mapin.Keys)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    Console.Write(", ");
                }
                Console.Write(key + " => " + mapin[key]);
            }
            Console.WriteLine("}");

            List<int> listout = new List<int>();
            for (int j = -2; j < 3; j++)
            {
                listout.Add(j);
            }
            Console.Write("testList({");
            first = true;
            foreach (int j in listout)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    Console.Write(", ");
                }
                Console.Write(j);
            }
            Console.Write("})");

            List<int> listin = client.testList(listout);

            Console.Write(" = {");
            first = true;
            foreach (int j in listin)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    Console.Write(", ");
                }
                Console.Write(j);
开发者ID:vicaya,项目名称:thrift,代码行数:67,代码来源:TestClient.cs

示例5: ExecuteClientTest


//.........这里部分代码省略.........
                {
                    first = false;
                }
                else
                {
                    Console.Write(", ");
                }
                Console.Write(key + " => " + mapout[key]);
            }
            Console.Write("})");

            Dictionary<int, int> mapin = client.testMap(mapout);

            Console.Write(" = {");
            first = true;
            foreach (int key in mapin.Keys)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    Console.Write(", ");
                }
                Console.Write(key + " => " + mapin[key]);
            }
            Console.WriteLine("}");

            // TODO: Validate received message
            List<int> listout = new List<int>();
            for (int j = -2; j < 3; j++)
            {
                listout.Add(j);
            }
            Console.Write("testList({");
            first = true;
            foreach (int j in listout)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    Console.Write(", ");
                }
                Console.Write(j);
            }
            Console.Write("})");

            List<int> listin = client.testList(listout);

            Console.Write(" = {");
            first = true;
            foreach (int j in listin)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    Console.Write(", ");
                }
                Console.Write(j);
开发者ID:ChristopherRogers,项目名称:thrift,代码行数:67,代码来源:TestClient.cs

示例6: Read

 public void Read (TProtocol iprot)
 {
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 0:
         if (field.Type == TType.Set) {
           {
             Success = new THashSet<string>();
             TSet _set222 = iprot.ReadSetBegin();
             for( int _i223 = 0; _i223 < _set222.Count; ++_i223)
             {
               string _elem224 = null;
               _elem224 = iprot.ReadString();
               Success.Add(_elem224);
             }
             iprot.ReadSetEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 1:
         if (field.Type == TType.Struct) {
           E = new TalkException();
           E.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }
开发者ID:Banandana,项目名称:LineSharp,代码行数:45,代码来源:TalkService.cs

示例7: Read

 public void Read (TProtocol iprot)
 {
   iprot.IncrementRecursionDepth();
   try
   {
     bool isset_msgType = false;
     TField field;
     iprot.ReadStructBegin();
     while (true)
     {
       field = iprot.ReadFieldBegin();
       if (field.Type == TType.Stop) { 
         break;
       }
       switch (field.ID)
       {
         case 1:
           if (field.Type == TType.I32) {
             MsgType = (VariableType)iprot.ReadI32();
             isset_msgType = true;
           } else { 
             TProtocolUtil.Skip(iprot, field.Type);
           }
           break;
         case 2:
           if (field.Type == TType.Bool) {
             BoolVal = iprot.ReadBool();
           } else { 
             TProtocolUtil.Skip(iprot, field.Type);
           }
           break;
         case 3:
           if (field.Type == TType.Byte) {
             ByteVal = iprot.ReadByte();
           } else { 
             TProtocolUtil.Skip(iprot, field.Type);
           }
           break;
         case 4:
           if (field.Type == TType.I32) {
             IntVal = iprot.ReadI32();
           } else { 
             TProtocolUtil.Skip(iprot, field.Type);
           }
           break;
         case 5:
           if (field.Type == TType.Double) {
             DoubleVal = iprot.ReadDouble();
           } else { 
             TProtocolUtil.Skip(iprot, field.Type);
           }
           break;
         case 6:
           if (field.Type == TType.String) {
             StrVal = iprot.ReadString();
           } else { 
             TProtocolUtil.Skip(iprot, field.Type);
           }
           break;
         case 7:
           if (field.Type == TType.String) {
             ByteArrVal = iprot.ReadBinary();
           } else { 
             TProtocolUtil.Skip(iprot, field.Type);
           }
           break;
         case 8:
           if (field.Type == TType.Map) {
             {
               MapVal = new Dictionary<BaseMsg, BaseMsg>();
               TMap _map0 = iprot.ReadMapBegin();
               for( int _i1 = 0; _i1 < _map0.Count; ++_i1)
               {
                 BaseMsg _key2;
                 BaseMsg _val3;
                 _key2 = new BaseMsg();
                 _key2.Read(iprot);
                 _val3 = new BaseMsg();
                 _val3.Read(iprot);
                 MapVal[_key2] = _val3;
               }
               iprot.ReadMapEnd();
             }
           } else { 
             TProtocolUtil.Skip(iprot, field.Type);
           }
           break;
         case 9:
           if (field.Type == TType.List) {
             {
               ListVal = new List<BaseMsg>();
               TList _list4 = iprot.ReadListBegin();
               for( int _i5 = 0; _i5 < _list4.Count; ++_i5)
               {
                 BaseMsg _elem6;
                 _elem6 = new BaseMsg();
                 _elem6.Read(iprot);
                 ListVal.Add(_elem6);
               }
               iprot.ReadListEnd();
//.........这里部分代码省略.........
开发者ID:wsycarlos,项目名称:ARIA,代码行数:101,代码来源:BaseMsg.cs

示例8: Read

 public void Read (TProtocol iprot)
 {
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 0:
         if (field.Type == TType.Set) {
           {
             Success = new THashSet<Dictionary<string, string>>();
             TSet _set104 = iprot.ReadSetBegin();
             for( int _i105 = 0; _i105 < _set104.Count; ++_i105)
             {
               Dictionary<string, string> _elem106 = new Dictionary<string, string>();
               {
                 _elem106 = new Dictionary<string, string>();
                 TMap _map107 = iprot.ReadMapBegin();
                 for( int _i108 = 0; _i108 < _map107.Count; ++_i108)
                 {
                   string _key109;
                   string _val110;
                   _key109 = iprot.ReadString();
                   _val110 = iprot.ReadString();
                   _elem106[_key109] = _val110;
                 }
                 iprot.ReadMapEnd();
               }
               Success.Add(_elem106);
             }
             iprot.ReadSetEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }
开发者ID:shentianyi,项目名称:ifDataHouse,代码行数:49,代码来源:Datahouse.cs

示例9: ClientTest


//.........这里部分代码省略.........
                if (first)
                {
                    first = false;
                }
                else
                {
                    Console.Write(", ");
                }
                Console.Write(key + " => " + mapout[key]);
            }
            Console.Write("})");

            Dictionary<int, int> mapin = client.testMap(mapout);

            Console.Write(" = {");
            first = true;
            foreach (int key in mapin.Keys)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    Console.Write(", ");
                }
                Console.Write(key + " => " + mapin[key]);
            }
            Console.WriteLine("}");

            List<int> listout = new List<int>();
            for (int j = -2; j < 3; j++)
            {
                listout.Add(j);
            }
            Console.Write("testList({");
            first = true;
            foreach (int j in listout)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    Console.Write(", ");
                }
                Console.Write(j);
            }
            Console.Write("})");

            List<int> listin = client.testList(listout);

            Console.Write(" = {");
            first = true;
            foreach (int j in listin)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    Console.Write(", ");
                }
                Console.Write(j);
开发者ID:luoaguo,项目名称:thrift,代码行数:67,代码来源:TestClient.cs

示例10: ExecuteClientTestAsync


//.........这里部分代码省略.........
                {
                    first = false;
                }
                else
                {
                    Console.Write(", ");
                }
                Console.Write(key + " => " + mapout[key]);
            }
            Console.Write("})");

            var mapin = await client.testMapAsync(mapout, token);

            Console.Write(" = {");
            first = true;
            foreach (var key in mapin.Keys)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    Console.Write(", ");
                }
                Console.Write(key + " => " + mapin[key]);
            }
            Console.WriteLine("}");

            // TODO: Validate received message
            var listout = new List<int>();
            for (var j = -2; j < 3; j++)
            {
                listout.Add(j);
            }
            Console.Write("testList({");
            first = true;
            foreach (var j in listout)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    Console.Write(", ");
                }
                Console.Write(j);
            }
            Console.Write("})");

            var listin = await client.testListAsync(listout, token);

            Console.Write(" = {");
            first = true;
            foreach (var j in listin)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    Console.Write(", ");
                }
                Console.Write(j);
开发者ID:nsuke,项目名称:thrift,代码行数:67,代码来源:TestClient.cs

示例11: Read

 public void Read (TProtocol iprot)
 {
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 0:
         if (field.Type == TType.Set) {
           {
             Success = new THashSet<Dictionary<string, string>>();
             TSet _set79 = iprot.ReadSetBegin();
             for( int _i80 = 0; _i80 < _set79.Count; ++_i80)
             {
               Dictionary<string, string> _elem81 = new Dictionary<string, string>();
               {
                 _elem81 = new Dictionary<string, string>();
                 TMap _map82 = iprot.ReadMapBegin();
                 for( int _i83 = 0; _i83 < _map82.Count; ++_i83)
                 {
                   string _key84;
                   string _val85;
                   _key84 = iprot.ReadString();
                   _val85 = iprot.ReadString();
                   _elem81[_key84] = _val85;
                 }
                 iprot.ReadMapEnd();
               }
               Success.Add(_elem81);
             }
             iprot.ReadSetEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }
开发者ID:shentianyi,项目名称:LEONIPack,代码行数:49,代码来源:Datahouse.cs


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