• C#练习3


    using System;
    class Test
    {
      static void F(params int[]args)
      {
          Console.WriteLine("# of argument:{0}",args.Length);
          for(int i=0;i<args.Length;i++)
              Console.WriteLine("	args[{0}]={1}",i,args[i]);
      }
      static void Main()
      {
          F();//没有参数,默认传递的是 new int[0],但不是null
          F(1);
          F(1, 2);
          F(1, 2, 3);
          F(new int[] { 1, 2, 3, 4 });
      }
    }
    using System;
    public class Stack
    {
        private Node first = null;
        public bool Empty
        {
            get
            {
                return (first == null);
            }
        }
        public object Pop()
        {
            if (first == null)
                throw new Exception("Can't Pop from an empty Stack.");
            else
            {
                object temp = first.Value;
                first = first.Next;
                return temp;
            }
        }
        public void push(object o)
        {
            first = new Node(o, first);
        }
        class Node
        {
            public Node Next;
            public object Value;
            public Node(object value) : this(value, null) { }
            public Node(object value,Node next)
            {
                Next = next;
                Value = value;
            }
        }
    }
  • 相关阅读:
    redis线程模型
    同步容器和并发容器
    200+面试题
    redis pipeline
    redis事务和脚本
    redis事务
    redis优缺点
    redis持久化策略
    Redis为什么要把所有数据放到内存中?
    redis的过期策略以及内存淘汰机制
  • 原文地址:https://www.cnblogs.com/zhangyongjian/p/3579612.html
Copyright © 2020-2023  润新知