Esempio n. 1
0
 /// <summary>
 /// GetAddress接口实现
 /// </summary>
 /// <param name="valueArgs">传入参数</param>
 /// <param name="code">传出状态码</param>
 /// <returns>接口返回值</returns>
 protected override List <string> Process(Nullables valueArgs, out StatusCode code)
 {
     code = StatusCode.OK;
     try
     {
         var cs = Cache.ResourceCache.Instance;
         if (!(cs?.IsExistCfg() ?? false))
         {
             throw new BusinessException("本服务没有配置Reource缓存服务,因此无法获取错误!");
         }
         var ss   = cs.PopAllQueue(ServerSetting.AppName);
         var logs = ss.Select(x =>
         {
             try
             {
                 return(JsonConvert.DeserializeObject <LogInfo>(x)?.ToString());
             }
             catch
             {
                 return(x);
             }
         }).ToList();
         return(logs);
     }
     catch (Exception ex)
     {
         throw new BusinessException(ex.Message);
     }
 }
Esempio n. 2
0
        // public delegate TResult Func<in T1,in T2, out TResult>(T1 arg1,T2 arg2);
        static void Main(string[] args)
        {
            int number1 = 5;
            // Lamba
            Func <int, int> squareOfNumber = i => number1 * number1;

            Console.WriteLine(squareOfNumber);

            var lambaDemo   = new LambaDemo();
            var listOFBooks = lambaDemo.GetBooks().Where(x => x.Price < 10).ToList();

            Func <int, int, int> add   = Sum;
            Func <int, int, int> minus = Subtract;
            int result = minus(5, 3);

            Console.WriteLine(result);
            var _doorProcessor = new UnlockDoorProcessor();
            var _door          = new Door();

            _door.KeyNumber = "MY121HN";
            Func <Door, string> processor1 = _doorProcessor.UnclockDoor;

            processor1 += OpenDoorWithRemote;
            var dd = processor1(_door);



            Console.ReadLine();



            var            processor     = new PhotoProcessor();
            var            filters       = new PhotoFilters();
            Action <Photo> filterHandler = filters.ApplyBrightness;

            filterHandler += CustomerFilter;
            filterHandler += filters.ApplyContrast;
            filterHandler += filters.Resize;
            processor.Process("hhh", filterHandler);

            var nullable = new Nullables <int>();
            var genericInitializerObject = new GenericInitializerObject <Student>();
            var student = genericInitializerObject.CreateInitializerObjectGeneric();

            student.Name    = "Sazi";
            student.Surname = "Nyathi";
            var results = nullable.GetVaueOrDefault();

            var number = new GenericList <int>();

            number.Add(10);

            var students = new GenericList <Student>();

            students.Add(student);

            var studentDictinary = new GenericDictionary <int, Student>();

            studentDictinary.Add(1, student);
        }
Esempio n. 3
0
 /// <summary>
 /// GetAddress接口实现
 /// </summary>
 /// <param name="valueArgs">传入参数</param>
 /// <param name="code">传出状态码</param>
 /// <returns>接口返回值</returns>
 protected override List <ClassInfo> Process(Nullables valueArgs, out StatusCode code)
 {
     code = StatusCode.OK;
     try
     {
         var helper = new ApiHelper(this.Assembly);
         if (this.args.ct == "webapi")
         {
             var list = helper.GetAllInterfaceClass(this.args.lg);
             return(list);
         }
         else
         {
             var list = helper.GetAllInterfaceClass(this.args.lg, true);
             return(list);
         }
     }
     catch (Exception ex)
     {
         throw new BusinessException(ex.Message);
     }
 }
Esempio n. 4
0
        public void DemoNullables()
        {
            Nullables nullables = new Nullables();

            nullables.Display();
        }
Esempio n. 5
0
 public void CheckCoalescingOperatorTest()
 {
     Nullables nullables = new Nullables();
     var       result    = nullables.CheckCoalescingOperator();
 }
Esempio n. 6
0
 public void CheckNullablesTest()
 {
     Nullables nullables = new Nullables();
     var       result    = nullables.CheckNullables();
 }
Esempio n. 7
0
 /// <summary>
 /// Check
 /// </summary>
 /// <param name="args">args</param>
 /// <param name="code">code</param>
 /// <returns>bool</returns>
 protected override bool Check(Nullables args, out StatusCode code)
 {
     code = StatusCode.OK;
     return(true);
 }
Esempio n. 8
0
		public void NullableConversion(Nullables.NullableDouble amount)
		{
			RenderText(String.Format("incoming {0} {1}", amount.HasValue, amount.ToString()));
		}