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

C# Pair类代码示例

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

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



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

示例1: Pair1_Unit_Constructor1_Optimal

 public void Pair1_Unit_Constructor1_Optimal()
 {
     String expected = default(String);
     Pair<String> target = new Pair<String>();
     Assert.AreEqual(expected, target.First);
     Assert.AreEqual(expected, target.Second);
 }
开发者ID:cegreer,项目名称:Common,代码行数:7,代码来源:PairTests.cs


示例2: Main

        static void Main(string[] args)
        {
            Console.WriteLine("We will now do some Pair Arithmetic!");

            PairArithmeticClient pairClient = new PairArithmeticClient();
            Pair p1 = new Pair { First = 15, Second = 22 };
            Pair p2 = new Pair { First = 7, Second = 13 };
            Console.WriteLine(string.Format("\r\nPair 1 is {{{0}, {1}}}", p1.First, p1.Second));
            Console.WriteLine(string.Format("Pair 2 is {{{0}, {1}}}", p2.First, p2.Second));
            Pair result = pairClient.Add(p1, p2);
            Console.WriteLine(string.Format("\r\nP1 + P2 is {{{0}, {1}}}", result.First, result.Second));

            result = pairClient.Subtract(p1, p2);
            Console.WriteLine(string.Format("\r\nP1 - P2 is {{{0}, {1}}}", result.First, result.Second));

            result = pairClient.ScalarMultiply(p1, 3);
            Console.WriteLine(string.Format("\r\nP1 * 3 is {{{0}, {1}}}", result.First, result.Second));

            PoliteClient politeClient = new PoliteClient();
            Console.WriteLine("");
            Console.WriteLine(politeClient.SayHello("Rob"));

            Console.WriteLine("\r\nDone\r\nPress any key to exit...");
            Console.ReadKey();
        }
开发者ID:robpocko,项目名称:rpServicePortalSuite,代码行数:25,代码来源:Program.cs


示例3: ObjectCreator

        public ObjectCreator(Manifest manifest, FileSystem.FileSystem modFiles)
        {
            typeCache = new Cache<string, Type>(FindType);
            ctorCache = new Cache<Type, ConstructorInfo>(GetCtor);

            // Allow mods to load types from the core Game assembly, and any additional assemblies they specify.
            var assemblyList = new List<Assembly>() { typeof(Game).Assembly };
            foreach (var path in manifest.Assemblies)
            {
                var data = modFiles.Open(path).ReadAllBytes();

                // .NET doesn't provide any way of querying the metadata of an assembly without either:
                //   (a) loading duplicate data into the application domain, breaking the world.
                //   (b) crashing if the assembly has already been loaded.
                // We can't check the internal name of the assembly, so we'll work off the data instead
                var hash = CryptoUtil.SHA1Hash(data);

                Assembly assembly;
                if (!ResolvedAssemblies.TryGetValue(hash, out assembly))
                {
                    assembly = Assembly.Load(data);
                    ResolvedAssemblies.Add(hash, assembly);
                }

                assemblyList.Add(assembly);
            }

            AppDomain.CurrentDomain.AssemblyResolve += ResolveAssembly;
            assemblies = assemblyList.SelectMany(asm => asm.GetNamespaces().Select(ns => Pair.New(asm, ns))).ToArray();
            AppDomain.CurrentDomain.AssemblyResolve -= ResolveAssembly;
        }
开发者ID:pchote,项目名称:OpenRA,代码行数:31,代码来源:ObjectCreator.cs


示例4: AcceptorBase

 internal AcceptorBase(FuncDecl symbol, Expr guard, ExprSet[] lookahead)
 {
     this.symbol = symbol;
     this.guard = guard;
     this.lookahead = lookahead;
     this.lhs = new Pair<FuncDecl, Sequence<ExprSet>>(symbol, new Sequence<ExprSet>(lookahead));
 }
开发者ID:AutomataDotNet,项目名称:Automata,代码行数:7,代码来源:TreeRule.cs


示例5: IsInRectangle

 /// <summary>
 /// Check if a point is within a given rectangle.
 /// </summary>
 /// <param name="pos">Position (in either world or screen coordinates)</param>
 /// <param name="x">Rectangle X position</param>
 /// <param name="y">Rectangle Y position</param>
 /// <param name="width">Rectangle width</param>
 /// <param name="height">Rectangle height</param>
 /// <returns>True if the point is in the given rectangle</returns>
 public static bool IsInRectangle(Pair<int> pos, int x, int y, int width, int height)
 {
     return (pos.x >= x &&
             pos.x <= x + width &&
             pos.y >= y &&
             pos.y <= y + height);
 }
开发者ID:GoodSky,项目名称:Sim-U,代码行数:16,代码来源:Geometry.cs


示例6: ConstructLambdaFromLet

 // Take a bag of LET components and write the equivalent LAMBDA
 // expression.  Handles named LET.
 private static Datum ConstructLambdaFromLet(LetComps comps)
 {
     // Unzip!
     List<Datum> names = new List<Datum>();
     List<Datum> vals = new List<Datum>();
     foreach (Pair p in comps.bindings)
     {
         names.Add(p.First);
         vals.Add(p.Second);
     }
     Datum formals = Primitives.List(names);
     Datum bodyFunc = new Pair(new Symbol("lambda"),
                               new Pair(formals, comps.body));
     Datum transform;
     if (comps.self == null)
     {
         // Unnamed LET.
         transform = new Pair(bodyFunc, Primitives.List(vals));
     }
     else
     {
         // Named LET.
         transform =
             new Pair(Datum.List(new Symbol("let"),
                                 Datum.List(Datum.List(comps.self,
                                                       null)),
                                 Datum.List(new Symbol("set!"),
                                            comps.self,
                                            bodyFunc),
                                 comps.self),
                      Primitives.List(vals));
     }
     Shell.Trace("LET transform produced ", transform);
     return transform;
 }
开发者ID:jleen,项目名称:sharpf,代码行数:37,代码来源:transform.cs


示例7: Item

            public Item(int value)
            {
                Value = value;
                NonSerializedValue = value;
                TransientValue = value;
				Pair = new Pair("p1", value);
            }
开发者ID:erdincay,项目名称:db4o,代码行数:7,代码来源:NonSerializedAttributeTestCase.cs


示例8: process

  public void process(Message message, SessionID sessionID)
  {
    Message echo = (Message)message;
    PossResend possResend = new PossResend(false);
    if (message.getHeader().isSetField(possResend))
      message.getHeader().getField(possResend);

    ClOrdID clOrdID = new ClOrdID();
    message.getField(clOrdID);

    Pair pair = new Pair(clOrdID, sessionID);

    if (possResend.getValue() == true)
    {
      if (orderIDs.Contains(pair))
        return;
    }
    if(!orderIDs.Contains(pair))
      orderIDs.Add(pair, pair);
    try
    {
      Session.sendToTarget(echo, sessionID);
    }
    catch (SessionNotFound) { }
  }
开发者ID:KorkyPlunger,项目名称:quickfix,代码行数:25,代码来源:at_messagecracker.cs


示例9: PasswordCommand

        void PasswordCommand(ISender sender, ArgumentList args)
        {
            Player player = sender as Player;
                Protection temp = new Protection ();
                Pair<Action, Protection> pair = new Pair<Action, Protection> (Action.NOTHING, null);

                if (args.Count != 1) {
                    player.SendMessage ("Usage: /cpassword <password>", 255, 255, 0, 0);
                    return;
                }

                string Extra = args[0];

                temp = new Protection ();
                temp.Owner = player.Name;
                temp.Type = Protection.PASSWORD_PROTECTION;
                temp.Data = SHA1.Hash (Extra);

                char[] pass = Extra.ToCharArray ();
                for (int index = 0; index < pass.Length; index++) {
                    pass [index] = '*';
                }

                pair.First = Action.CREATE;
                pair.Second = temp;

                player.SendMessage ("Password: " + new string (pass), 255, 255, 0, 0);
                player.SendMessage ("Open the chest to protect it!", 255, 0, 255, 0);

            // cache the action if it's not null!
            if (pair.First != Action.NOTHING) {
                ResetActions (player);
                Cache.Actions.Add (player.Name, pair);
            }
        }
开发者ID:elevatorguy,项目名称:LWC-Terraria,代码行数:35,代码来源:Commands.cs


示例10: Heap

        public Heap(Pair[] _points)
        {
            this.points = _points;
            int pointsCount = _points.Length;

            int leafsCount = pointsCount;
            leafsCount = leafsCount - 1;
            leafsCount = leafsCount | (leafsCount >> 1);
            leafsCount = leafsCount | (leafsCount >> 2);
            leafsCount = leafsCount | (leafsCount >> 4);
            leafsCount = leafsCount | (leafsCount >> 8);
            leafsCount = leafsCount | (leafsCount >> 16);
            leafsCount = leafsCount | (leafsCount >> 32);
            leafsCount = leafsCount + 1;

            this.count = 2 * leafsCount - 1;
            this.heap = new int[this.count];

            for (int i = 0; i < pointsCount; i++) {
                this.heap[this.count - 1 - i] = i;
            }
            for (int i = count - 1 - pointsCount; i >= 0; i--) {
                this.heap[i] = int.MinValue;
            }
            BuildHeap();
        }
开发者ID:OlgaRabodzei,项目名称:NetForMap_CSharp,代码行数:26,代码来源:Heap.cs


示例11: Proxy

        void Proxy(object user)
        {
            Pair p = new Pair();
            p.inst = Interlocked.Increment(ref inst);
            p.sl = (Socket)user;
            p.sr = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

            lock (lck) Console.WriteLine("{0} Connect now", p.Id);

            p.sr.Connect(e2);

            lock (lck) Console.WriteLine("{0} Connected", p.Id);

            Thread tlr = new Thread(Dolr);
            tlr.Start(p);
            Thread trl = new Thread(Dorl);
            trl.Start(p);

            tlr.Join();
            trl.Join();

            lock (lck) Console.WriteLine("{0} Shutdown now", p.Id);

            p.sr.Shutdown(SocketShutdown.Both);
            p.sl.Shutdown(SocketShutdown.Both);

            lock (lck) Console.WriteLine("{0} Close now", p.Id);

            p.sr.Close();
            p.sl.Close();

            lock (lck) Console.WriteLine("{0} Finished", p.Id);
        }
开发者ID:HiraokaHyperTools,项目名称:TCPRelay,代码行数:33,代码来源:Program.cs


示例12: Bootstrap

        /// <summary>
        /// Bootstraps to the given peer addresses. I.e., looking for near nodes.
        /// </summary>
        /// <param name="peerAddresses">The node to which bootstrap should be performed to.</param>
        /// <param name="routingBuilder">All relevant information for the routing process.</param>
        /// <param name="cc">The channel creator.</param>
        /// <returns>A task object that is set to complete if the route has been found.</returns>
        public Task<Pair<TcsRouting, TcsRouting>> Bootstrap(ICollection<PeerAddress> peerAddresses,
            RoutingBuilder routingBuilder, ChannelCreator cc)
        {
            // search close peers
            Logger.Debug("Bootstrap to {0}.", Convenient.ToString(peerAddresses));
            var tcsDone = new TaskCompletionSource<Pair<TcsRouting, TcsRouting>>();

            // first, we find close peers to us
            routingBuilder.IsBootstrap = true;

            var tcsRouting0 = Routing(peerAddresses, routingBuilder, Message.Message.MessageType.Request1, cc);
            // we need to know other peers as well
            // this is important if this peer is passive and only replies on requests from other peers
            tcsRouting0.Task.ContinueWith(taskRouting0 =>
            {
                if (!taskRouting0.IsFaulted)
                {
                    // setting this to null causes to search for a random number
                    routingBuilder.LocationKey = null;
                    var tcsRouting1 = Routing(peerAddresses, routingBuilder, Message.Message.MessageType.Request1, cc);
                    tcsRouting1.Task.ContinueWith(taskRouting1 =>
                    {
                        var pair = new Pair<TcsRouting, TcsRouting>(tcsRouting0, tcsRouting1);
                        tcsDone.SetResult(pair);
                    });
                }
                else
                {
                    tcsDone.SetException(taskRouting0.TryGetException());
                }
            });

            return tcsDone.Task;
        }
开发者ID:pacificIT,项目名称:TomP2P.NET,代码行数:41,代码来源:DistributedRouting.cs


示例13: RoundWin

 void RoundWin(Pair<int, float> winInfo)
 {
     // init values
     targetCol = gameMan.pColor[winInfo.First];
     winDuration = winInfo.Second / winSpeedFactor;
     winTimer = 0;
 }
开发者ID:izzy-sabur,项目名称:polish_proj,代码行数:7,代码来源:ColorChangeOnWin.cs


示例14: Team8x4ViewModel

 /// <summary>
 /// Initializes a new instance of the Team8x4ViewModel class.
 /// </summary>
 public Team8x4ViewModel()
 {
     Pair1 = new Pair();
     Pair2 = new Pair();
     Pair3 = new Pair();
     Pair4 = new Pair();
 }
开发者ID:dlidstrom,项目名称:Snittlistan,代码行数:10,代码来源:Team8x4ViewModel.cs


示例15: Main

        static void Main(string[] args)
        {
            // Question 1
            foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
            {
                if (asm.GetName().Name == "tp3")
                {
                    foreach (Type ty in asm.GetTypes())
                    {
                        Console.WriteLine(" Classe : " + ty);
                        foreach (MethodInfo mi in ty.GetMethods())
                        {
                            Console.WriteLine(" Methode : " + mi);
                            foreach (ParameterInfo pi in mi.GetParameters())
                                Console.WriteLine("Parametre : " + pi.GetType());
                        }
                    }
                }
            }

            // Question 2
            Console.WriteLine();
            Pair<int, char> p = new Pair<int, char>(5, 'c');
            Console.WriteLine("Paire:" + p.El1 + " " + p.El2);

            // Question 3

            HashTableReflection tab = new HashTableReflection();

            Console.ReadLine();
        }
开发者ID:ulricheza,项目名称:Isima,代码行数:31,代码来源:Program.cs


示例16: Enemy

 static Enemy()
 {
     _mdl = OBJModelParser.GetInstance().Parse("res/mdl/enemy");
     _garbage = new Bitmap(1, 1);
     _garbageg = Graphics.FromImage(_garbage);
     List<Pair<string, Rect2D>> quotes = new List<Pair<string, Rect2D>>();
     using (StreamReader s = new StreamReader("res/screams.txt")) {
         while (!s.EndOfStream) {
             string q = s.ReadLine();
             while (q.EndsWith(@"\")) {
                 q = q.Substring(0, q.Length - 1);
                 q += "\n";
                 q += s.ReadLine();
             }
             SizeF size = _garbageg.MeasureString(q, SystemFonts.DefaultFont);
             Bitmap img = new Bitmap((int)size.Width + 6, (int)size.Height + 6);
             Graphics g = Graphics.FromImage(img);
             g.FillRectangle(Brushes.White, 0, 0, img.Width, img.Height);
             g.DrawString(q, SystemFonts.DefaultFont, Brushes.Black, 3, 3);
             g.Dispose();
             Pair<string, Rect2D> ins = new Pair<string, Rect2D>();
             ins.First = q;
             const int SCALE = 30;
             const int SCALE2 = 2 * SCALE;
             ins.Second = new Rect2D(img,
                     -(size.Width / SCALE2), -(size.Height / SCALE2),
                     (size.Width / SCALE), (size.Height / SCALE));
             quotes.Add(ins);
         }
     }
     _garbageg.Dispose();
     _garbageg = null; //Prevent accidental use.
     _quotes = quotes.ToArray();
     _r = new Random();
 }
开发者ID:bobtwinkles,项目名称:Defence,代码行数:35,代码来源:Enemy.cs


示例17: SwapingForTerm

        /// <summary>
        /// 基本代换班
        /// </summary>
        public void SwapingForTerm(Pair<Guid> agentPair, Pair<long?> assignmentPair, bool isLaborRule)
        {
            ReSet();
            _attendanceRepository.Clear();
            GetSwapingDate(assignmentPair);
            Initialize(agentPair,isLaborRule);

            Applier.InitializeSwapingForTerm(assignmentPair.Applier);
            Replier.InitializeSwapingForTerm(assignmentPair.Replier);
            if (Applier.Term != null)
            {
                Replier.TimeOff = Replier.TimeBox.SpecificTerm<TimeOff>().CollideTerms(Applier.Term).FirstOrDefault();
            }
            if (Replier.Term != null)
            {
                Applier.TimeOff = Applier.TimeBox.SpecificTerm<TimeOff>().CollideTerms(Replier.Term).FirstOrDefault();
            }
            //删除班
            DeleteTerm();
            //设置TimeOff
            SetTimeOff();
            //交换班表
            SwapSpecificTerm();
            SwapSpecificSubEvents();
            //验证交换信息
            VaildateSwapMessage();
        }
开发者ID:Mrding,项目名称:Ribbon,代码行数:30,代码来源:BoxPairSwapModel.cs


示例18: GetActualPos

 public static Vector2 GetActualPos(Pair coord)
 {
     Vector2 result;
     result.x = - coord.x * 0.5f + coord.y * 0.5f;
     result.y = coord.x * 0.25f + coord.y * 0.25f;
     return result;
 }
开发者ID:z530989673,项目名称:MovieStudio,代码行数:7,代码来源:SceneManager.cs


示例19: GetAlbumArtAsync

 public void GetAlbumArtAsync(MediaControl.Client.Console.MediaLibrary.Track track,
     Action<byte[], object> callback, object state)
 {
     Pair<Action<byte[], object>, object> pair =
         new Pair<Action<byte[], object>, object>(callback, state);
     LibraryServiceClient.GetAlbumArtAsync(new GetAlbumArtRequest(track), pair);
 }
开发者ID:garyjohnson,项目名称:Remotive,代码行数:7,代码来源:MediaService.cs


示例20: CodeBrowser

         public CodeBrowser()
            : base(Constants.WINDOW_ID_CODEBROWSER, "Ribbon Codes")
         {
            STYLE_CODE.stretchWidth = false;
            STYLE_CODE.fixedWidth = 100;
            STYLE_CODE.alignment = TextAnchor.MiddleLeft;
            STYLE_NAME.stretchWidth = true;
            STYLE_NAME.alignment = TextAnchor.MiddleLeft;
            //
            // copy activitiesfor sorting into code list
            Log.Detail("adding action codes to code browser " + ActionPool.Instance());
            foreach (Activity activity in ActivityPool.Instance())
            {
               Pair<String, String> code = new Pair<String, String>(activity.GetCode(), activity.GetName());
               codes.Add(code);
            }

            // sort by code
            Log.Detail("sorting codes in code browser");
            codes.Sort(
               delegate(Pair<String,String> left, Pair<String,String> right)
               {
                  return left.first.CompareTo(right.first);
               });
         }
开发者ID:Kerbas-ad-astra,项目名称:FinalFrontier,代码行数:25,代码来源:CodeBrowser.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Palette类代码示例发布时间:2022-05-24
下一篇:
C# PaintEventArgs类代码示例发布时间: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