Inheritance: BehaviourTree
示例#1
0
 public static bool SetLove(LoveType loveType, ImgInfo info)
 {
     try
     {
         Picture picModel = db.Queryable <Picture>().Where(o => o.Id == info.Id).First();
         Love    love     = db.Queryable <Love>().Where(o => o.PictureId == info.Id).First();
         if (picModel == null || love == null) //目前仅考虑第一次收藏
         {
             SetTagLove(loveType, info);
         }
         if (picModel == null)
         {
             picModel = ToPicture(info);
             db.Insertable(picModel).ExecuteCommand();
         }
         love = new Love()
         {
             PictureId = info.Id, Time = DateTime.Now, Type = (int)loveType
         };
         db.Saveable(love).ExecuteCommand();
         return(true);
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog(ex.Message, EnumLogLevel.Error);
         return(false);
     }
 }
示例#2
0
 /// <summary>
 /// ValuesController
 /// </summary>
 /// <param name="blogArticleServices"></param>
 /// <param name="mapper"></param>
 /// <param name="advertisementServices"></param>
 /// <param name="love"></param>
 /// <param name="roleModulePermissionServices"></param>
 /// <param name="user"></param>
 /// <param name="passwordLibServices"></param>
 /// <param name="blogApi"></param>
 /// <param name="doubanApi"></param>
 public ValuesController(IBlogArticleServices blogArticleServices
                         , IMapper mapper
                         , IAdvertisementServices advertisementServices
                         , Love love
                         , IRoleModulePermissionServices roleModulePermissionServices
                         , IUser user, IPasswordLibServices passwordLibServices
                         , IBlogApi blogApi
                         , IDoubanApi doubanApi)
 {
     // 测试 Authorize 和 mapper
     _mapper = mapper;
     _advertisementServices = advertisementServices;
     _love = love;
     _roleModulePermissionServices = roleModulePermissionServices;
     // 测试 Httpcontext
     _user = user;
     // 测试多库
     _passwordLibServices = passwordLibServices;
     // 测试http请求
     _blogApi   = blogApi;
     _doubanApi = doubanApi;
     // 测试AOP加载顺序,配合 return
     _blogArticleServices = blogArticleServices;
     // 测试redis消息队列
     _blogArticleServices = blogArticleServices;
 }
示例#3
0
 /// <summary>
 /// ValuesController
 /// </summary>
 /// <param name="mapper"></param>
 /// <param name="advertisementServices"></param>
 public ValuesController(IMapper mapper, IAdvertisementServices advertisementServices, Love love)
 {
     // 测试 Authorize 和 mapper
     _mapper = mapper;
     _advertisementServices = advertisementServices;
     _love = love;
 }
示例#4
0
 /// <summary>
 /// ValuesController
 /// </summary>
 /// <param name="mapper"></param>
 /// <param name="advertisementServices"></param>
 /// <param name="love"></param>
 /// <param name="roleModulePermissionServices"></param>
 public ValuesController(IMapper mapper, IAdvertisementServices advertisementServices, Love love, IRoleModulePermissionServices roleModulePermissionServices)
 {
     // 测试 Authorize 和 mapper
     _mapper = mapper;
     _advertisementServices = advertisementServices;
     _love = love;
     _roleModulePermissionServices = roleModulePermissionServices;
 }
示例#5
0
        private void InsertIntoTable(Love unit)
        {
            string folder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);

            using (var connection = new SQLiteConnection(System.IO.Path.Combine(folder, "LoveDB.db")))
            {
                connection.Insert(unit);
            }
        }
示例#6
0
        public ActionResult LoveUnClick(int postID)
        {
            acc = db.Account.Where(s => s.Username == User.Identity.Name).FirstOrDefault();
            Love love = db.Love.Where(s => s.PostID == postID && s.UserID == acc.AccID).FirstOrDefault();

            db.Love.Remove(love);
            db.SaveChanges();
            return(Json(true, JsonRequestBehavior.AllowGet));
        }
示例#7
0
        /// <summary>
        /// Returns the truths for the current love.
        /// </summary>
        /// <param name="parameters">parameters</param>
        /// <param name="result">results</param>
        private void OnGetTruths(NameValueCollection parameters, dynamic result)
        {
            if (result.love == -1)
            {
                return;
            }
            this.LoveId = result.love;
            var url = Constants.URL_GET_BODY + this.LoveId;

            WebQueue.Instance.Get(url, this.OnGetBodies);
            url = Constants.URL_GET_STYLE + this.LoveId;
            WebQueue.Instance.Get(url, this.OnGetStyles);
            url = Constants.URL_GET_ALIAS + this.LoveId;
            WebQueue.Instance.Get(url, this.OnGetAlias);
            foreach (var t in result.truths)
            {
                var lights = new List <Light> ();
                foreach (var light in t.Value.l)
                {
                    lights.Add(new Light {
                        Id = light.id, Text = light.text
                    });
                }
                var love = new Love {
                    Id    = t.Value.id,
                    Light = lights.Last()
                };
                for (var a = 0; a < lights.Count - 1; a++)
                {
                    love.Peace.Add(lights [a]);
                }
                var truth = new Truth(this, Convert.ToInt32(t.Value.tid))
                {
                    Order      = t.Value.order,
                    Love       = love,
                    IsModified = false
                };
                if (t.Value.a != null)
                {
                    truth.Alias = Convert.ToInt32(t.Value.a);
                }
                if (t.Value.b != null)
                {
                    foreach (var body in t.Value.b)
                    {
                        truth.Bodies.Add(new Body(truth, Convert.ToInt32(t.Value.id))
                        {
                            Id       = body.id,
                            Text     = body.text,
                            Position = body.position
                        });
                    }
                }
                this.Truth.Add(truth);
            }
        }
示例#8
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        MovieDataContext db   = new MovieDataContext();
        Love             love = new Love();

        love.MovieId = TextBox1.Text;
        db.Love.InsertOnSubmit(love);
        db.SubmitChanges();
        Response.Write("<script type='text/javascript'>alert('收藏成功!正在跳转到登陆页面');location.href='Mylove.aspx';</script> ");
    }
示例#9
0
        public ActionResult LoveCheck(int postID)
        {
            acc = db.Account.Where(s => s.Username == User.Identity.Name).FirstOrDefault();
            Love love = db.Love.Where(s => s.PostID == postID && s.UserID == acc.AccID).FirstOrDefault();

            if (love != null)
            {
                return(Json(true, JsonRequestBehavior.AllowGet));
            }
            return(Json(false, JsonRequestBehavior.AllowGet));
        }
示例#10
0
        public async Task <MessageModel <ResponseEnum> > Get()
        {
            var data = new MessageModel <ResponseEnum>();

            _advertisementServices.ReturnExp();

            Love love = null;

            love.SayLoveU();

            return(data);
        }
示例#11
0
        public async Task <MessageModel <ResponseEnum> > Get()
        {
            var data = new MessageModel <ResponseEnum>();

            await _redisBasketRepository.ListLeftPushAsync(RedisMqKey.Loging, "xxxxxxxxxxxxxxxxxxx");

            /*
             *  测试 sql 查询
             */
            var queryBySql = await _blogArticleServices.QuerySql("SELECT bsubmitter,btitle,bcontent,bCreateTime FROM BlogArticle WHERE bID>5");


            /*
             *  测试 sql 更新
             *
             * 【SQL参数】:@bID:5
             *  @bsubmitter:laozhang619
             *  @IsDeleted:False
             * 【SQL语句】:UPDATE `BlogArticle`  SET
             *  `bsubmitter`=@bsubmitter,`IsDeleted`=@IsDeleted  WHERE `bID`=@bID
             */
            var updateSql = await _blogArticleServices.Update(new { bsubmitter = $"laozhang{DateTime.Now.Millisecond}", IsDeleted = false, bID = 5 });


            // 测试模拟异常,全局异常过滤器拦截
            var i = 0;
            var d = 3 / i;


            // 测试 AOP 缓存
            var blogArticles = await _blogArticleServices.GetBlogs();


            // 测试多表联查
            var roleModulePermissions = await _roleModulePermissionServices.QueryMuchTable();


            // 测试多个异步执行时间
            var roleModuleTask = _roleModulePermissionServices.Query();
            var listTask       = _advertisementServices.Query();
            var ad             = await roleModuleTask;
            var list           = await listTask;


            // 测试service层返回异常
            _advertisementServices.ReturnExp();

            Love love = null;

            love.SayLoveU();

            return(data);
        }
示例#12
0
 public ActionResult <string> PostLove(Love love)
 {
     if (love == null)
     {
         return(BadRequest());
     }
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     return("PostLove" + love.Name + love.Age);
 }
示例#13
0
 /// <summary>
 /// ValuesController
 /// </summary>
 /// <param name="blogArticleServices"></param>
 /// <param name="mapper"></param>
 /// <param name="advertisementServices"></param>
 /// <param name="love"></param>
 /// <param name="roleModulePermissionServices"></param>
 /// <param name="user"></param>
 public ValuesController(IBlogArticleServices blogArticleServices, IMapper mapper, IAdvertisementServices advertisementServices, Love love, IRoleModulePermissionServices roleModulePermissionServices, IUser user)
 {
     // 测试 Authorize 和 mapper
     _mapper = mapper;
     _advertisementServices = advertisementServices;
     _love = love;
     _roleModulePermissionServices = roleModulePermissionServices;
     // 测试 Httpcontext
     _user = user;
     // 测试AOP加载顺序,配合 return
     _blogArticleServices = blogArticleServices;
 }
示例#14
0
        /// <summary>
        /// Gets the list of other loves in the given truths.
        /// </summary>
        /// <param name="love">Love with truths to check.</param>
        private void GetOtherLoves(Love love)
        {
            var otherLoves = new Dictionary <int, Love> ();

            foreach (var t in love.Truths)
            {
                if (t.ParentId.HasValue && !otherLoves.ContainsKey(t.ParentId.Value))
                {
                    otherLoves.Add(t.ParentId.Value, this.Database.Love.Get(t.ParentId.Value));
                }
            }
            ViewBag.OtherLoves = otherLoves;
        }
示例#15
0
        public async Task <IActionResult> AddPackageLove(string packageId)
        {
            await GetLoggedInUser();

            var love = new Love
            {
                AuthorId      = user.Id,
                TourPackageId = new Guid(packageId)
            };

            await _tourPackageService.AddLoveAsync(love);

            return(RedirectToAction("ViewPackage", "Company", new { packageId = packageId }));
        }
示例#16
0
        public async Task <MessageModel <ResponseEnum> > Get()
        {
            var data = new MessageModel <ResponseEnum>();

            var list = await _roleModulePermissionServices.TestModelWithChildren();


            _advertisementServices.ReturnExp();

            Love love = null;

            love.SayLoveU();

            return(data);
        }
示例#17
0
        public async Task <MessageModel <ResponseEnum> > Get()
        {
            var data = new MessageModel <ResponseEnum>();

            var roleModuleTask = _roleModulePermissionServices.Query();
            var listTask       = _advertisementServices.Query();

            var ad   = await roleModuleTask;
            var list = await listTask;


            _advertisementServices.ReturnExp();

            Love love = null;

            love.SayLoveU();

            return(data);
        }
示例#18
0
        private static void Main(string[] args)
        {
            ObjectStructure obj = new ObjectStructure();

            obj.Attach(new Man());
            obj.Attach(new Woman());

            Success success = new Success();

            obj.Display(success);

            Fail fail = new Fail();

            obj.Display(fail);

            Love love = new Love();

            obj.Display(love);

            Console.Read();
        }
示例#19
0
        private void AddData()
        {
            ICursor selectData = sqlitedb.RawQuery("select * from Love", new string[] { });

            if (selectData.Count > 0)
            {
                selectData.MoveToFirst();
                do
                {
                    love        = new Love();
                    love.number = selectData.GetString(selectData.GetColumnIndex("number"));
                    love.type   = selectData.GetString(selectData.GetColumnIndex("type"));
                    loveList.Add(love);
                } while (selectData.MoveToNext());
                selectData.Close();
            }
            foreach (var item in loveList)
            {
                loveStrList.Add("(" + item.type + ")   " + item.number);
            }
        }
示例#20
0
        private void InitBtnState(ImgInfo imgInfo)
        {
            btn_love.Foreground    = Brushes.White;
            btn_dislike.Foreground = Brushes.White;
            btn_down.Foreground    = Brushes.White;

            Love love = UserDataManage.GetLove(imgInfo.Id);

            if (love != null)
            {
                if (love.Type == 1)
                {
                    btn_love.Foreground = Brushes.Red;
                }
                else if (love.Type == -1)
                {
                    btn_dislike.Foreground = Brushes.Red;
                }
            }
            Download down     = UserDataManage.GetDown(imgInfo.Id);
            string   fullName = System.IO.Path.Combine(this.DownPath, imgInfo.GetFileName());

            if (System.IO.File.Exists(fullName))
            {
                btn_down.Foreground = Brushes.Red;
                if (down == null)
                {
                    down = new Download()
                    {
                        PictureId = imgInfo.Id, Time = DateTime.Now, FullName = fullName, Valid = 1
                    };
                }
                else if (down.Valid == 0)
                {
                    down.Valid = 1;
                }
                UserDataManage.SaveDown(down, imgInfo);
            }
        }
示例#21
0
        /// <summary>
        /// Executes the add edit light command.
        /// </summary>
        /// <param name="obj">Command Parameter, not used.</param>
        private void OnAddEditLight(object obj)
        {
            var love = new Love {
                Light = new Light {
                    Id   = this.EditLight.Last().Id,
                    Text = this.EditLight.Last().Text
                }
            };

            for (var a = 0; a < this.EditLight.Count - 1; a++)
            {
                love.Peace.Add(new Light {
                    Id   = this.EditLight[a].Id,
                    Text = this.EditLight[a].Text
                });
            }
            this.Truth.Add(new Truth(this)
            {
                Love  = love,
                IsNew = true,
                Order = !this.Truth.Any() ? 1 : this.Truth.Max(l => l.Order) + 1
            });
        }
示例#22
0
        /// <summary>
        /// 初始化壁纸上显示的按钮状态
        /// </summary>
        /// <param name="imgInfo"></param>
        private void InitBtnState(ImgInfo imgInfo)
        {
            if (imgInfo == null)
            {
                return;
            }
            btnPanel.Tag             = imgInfo;
            btn_love.Foreground      = Brushes.White;
            btn_wallpaper.Foreground = Brushes.White;
            btn_dislike.Foreground   = Brushes.White;
            btn_down.Foreground      = Brushes.White;

            btnPanel.Visibility = Visibility.Visible;

            Love love = UserDataManage.GetLove(imgInfo.Id);

            if (love != null)
            {
                if (love.Type == 1)
                {
                    btn_love.Foreground = Brushes.Red;
                }
                else if (love.Type == -1)
                {
                    btn_dislike.Foreground = Brushes.Red;
                }
            }
            Download down     = UserDataManage.GetDown(imgInfo.Id);
            string   fullName = System.IO.Path.Combine(this.DownPath, imgInfo.GetFileName());

            if (System.IO.File.Exists(fullName))
            {
                btn_down.Foreground = Brushes.Red;
                UserDataManage.SetDown(fullName, imgInfo);
            }
        }
示例#23
0
        public object Any(Love request)
        {
            Guid userId = UserSession.GetUserId();

            LoveResponse response = new LoveResponse
            {
                Result = ErrorCode.OK,
            };

            TableRepository tableRepository = new TableRepository();

            UserQuestionEntry userQuestionEntry = tableRepository.Get <UserQuestionEntry>(Tables.UserQuestion, request.QuestionId, userId);

            // Création d'un nouveau vote
            if (userQuestionEntry == null)
            {
                DateTime dateTime = DateTime.UtcNow;
                userQuestionEntry = new UserQuestionEntry(request.QuestionId, userId)
                {
                    Creation     = dateTime,
                    Modification = dateTime
                };
            }
            else
            {
                userQuestionEntry.Modification = DateTime.UtcNow;
            }


            userQuestionEntry.Love = !userQuestionEntry.Love;

            // insert le vote
            tableRepository.InsertOrReplace(userQuestionEntry, Tables.UserQuestion);

            return(response);
        }
示例#24
0
        public object Any(Love request)
        {
            Guid userId = UserSession.GetUserId();

            LoveResponse response = new LoveResponse
            {
                Result = ErrorCode.OK,
            };

            TableRepository tableRepository = new TableRepository();

            UserQuestionEntry userQuestionEntry = tableRepository.Get<UserQuestionEntry>(Tables.UserQuestion, request.QuestionId, userId);

            // Création d'un nouveau vote
            if (userQuestionEntry == null)
            {
                DateTime dateTime = DateTime.UtcNow;
                userQuestionEntry = new UserQuestionEntry(request.QuestionId, userId)
                {
                    Creation = dateTime,
                    Modification = dateTime
                };
            }
            else
            {
                userQuestionEntry.Modification = DateTime.UtcNow;
            }

            userQuestionEntry.Love = !userQuestionEntry.Love;

            // insert le vote
            tableRepository.InsertOrReplace(userQuestionEntry, Tables.UserQuestion);

            return response;
        }
示例#25
0
 public void PostLove(Love love)
 {
 }
 partial void UpdateLove(Love instance);
 partial void DeleteLove(Love instance);
示例#28
0
 public display()
 {
     InitializeComponent();
     lv = new Love();
 }
示例#29
0
        public async Task <bool> GetThisAction(Love model)
        {
            await Task.Delay(0);

            return(true);
        }
示例#30
0
    void InitSwaps()
    {
        Angry.setPosition(new Position(Level.Excluded, Circle.Green));
        Blessing.setPosition(new Position(Level.Excluded, Circle.Purple));
        Child.setPosition(new Position(Level.Excluded, Circle.Red));
        Curse.setPosition(new Position(Level.Excluded, Circle.Cyan));
        Heaven.setPosition(new Position(Level.Tertiary, Circle.GreenPurpleRed));
        Happiness.setPosition(new Position(Level.Tertiary, Circle.GreenRedCyan));
        Dragon.setPosition(new Position(Level.Tertiary, Circle.RedCyanPurple));
        Dream.setPosition(new Position(Level.Secondary, Circle.CyanRed));
        Energy.setPosition(new Position(Level.Secondary, Circle.GreenRed));
        Female.setPosition(new Position(Level.Secondary, Circle.CyanPurple));
        Force.setPosition(new Position(Level.Quaternary, Circle.GreenRedCyanPurple));
        Forest.setPosition(new Position(Level.Excluded, Circle.Purple));
        Friend.setPosition(new Position(Level.Secondary, Circle.GreenPurple));
        Hate.setPosition(new Position(Level.Secondary, Circle.GreenPurple));
        Hope.setPosition(new Position(Level.Excluded, Circle.Green));
        Kindness.setPosition(new Position(Level.Tertiary, Circle.CyanPurpleGreen));
        Longevity.setPosition(new Position(Level.Secondary, Circle.CyanPurple));
        Love.setPosition(new Position(Level.Secondary, Circle.CyanPurple));
        Loyal.setPosition(new Position(Level.Secondary, Circle.GreenRed));
        Spirit.setPosition(new Position(Level.Secondary, Circle.CyanRed));
        Male.setPosition(new Position(Level.Quaternary, Circle.GreenRedCyanPurple));
        Mountain.setPosition(new Position(Level.Secondary, Circle.GreenRed));
        Night.setPosition(new Position(Level.Excluded, Circle.Red));
        Pure.setPosition(new Position(Level.Secondary, Circle.GreenPurple));
        Heart.setPosition(new Position(Level.Secondary, Circle.CyanRed));
        River.setPosition(new Position(Level.Excluded, Circle.Cyan));
        Emotion.setPosition(new Position(Level.Excluded, Circle.Cyan));
        Soul.setPosition(new Position(Level.Excluded, Circle.Purple));
        Urgency.setPosition(new Position(Level.Excluded, Circle.Red));
        Wind.setPosition(new Position(Level.Excluded, Circle.Green));

        Debug.LogFormat("[Dragon Energy #{0}] Before swapping, the displayed words are:", _moduleId);
        for (int i = 0; i < displayed.Length; i++)
        {
            Debug.LogFormat("[Dragon Energy #{0}] {1} = {2}", _moduleId, displayed[i].getWord(), displayed[i].getPosition().getCircle().ToReadable());
        }

        char[] letters    = info.GetSerialNumberLetters().ToArray();
        int    vowelCount = 0;

        foreach (char letter in letters)
        {
            if (letter == 'A' || letter == 'E' || letter == 'I' || letter == 'O' || letter == 'U')
            {
                vowelCount++;
            }
        }

        if (info.GetBatteryCount() > 10 && (info.GetSerialNumberNumbers().ToArray()[info.GetSerialNumberNumbers().ToArray().Length - 1] == 5 || info.GetSerialNumberNumbers().ToArray()[info.GetSerialNumberNumbers().ToArray().Length - 1] == 7))
        {
            Swaps(1);
        }
        else if (info.GetPortPlateCount() > info.GetBatteryHolderCount() && (modules.Contains("Morse War") || modules.Contains("Double Color")))
        {
            Swaps(2);
        }
        else if ((info.IsIndicatorOn(Indicator.SIG) && info.IsIndicatorOn(Indicator.FRK)) || (info.GetOffIndicators().Count() == 3))
        {
            Swaps(3);
        }
        else if (info.GetModuleNames().Count() > 8)
        {
            Swaps(4);
        }
        else if (vowelCount >= 2)
        {
            Swaps(5);
        }
        else if (info.GetSolvedModuleNames().Count() == 0)
        {
            Swaps(6);
            dependsOnSolvedModules = true;
        }
        else
        {
            Swaps(7);
        }

        Debug.LogFormat("[Dragon Energy #{0}] After swapping, the displayed words are:", _moduleId);
        for (int i = 0; i < displayed.Length; i++)
        {
            Debug.LogFormat("[Dragon Energy #{0}] {1} = {2}", _moduleId, displayed[i].getWord(), displayed[i].getPosition().getCircle().ToReadable());
        }
    }
 public void Post(Love love)
 {
 }
        static void Main(string[] args)
        {
            Love b = new Love();

            Console.WriteLine("main code before destructor runs");


            /*
             * Static Members
             * class members (variables, properties, methods) can also be declared as static. This makes those members belong to the class itself, instead
             * of belonging to individual objects, no matter how many object of the class are created, there is only one copy of the static member
             * eg
             * class Dog {
             *     public static int count = 0;
             *     public Dog() {
             *         count++;
             *     }
             * }
             * Here we declared a public member variable count, which is static. The constructor of the class increments the count variable by one.
             * Note that no matter how many Dog objects are instantiated, ther is always only one count variable that belongs to the cat
             * class because it was declared static
             *
             * because of their global nature, static members can be accessed directly using the class name without an object
             * eg2 below , also, Cat Class (45)
             */

            Cat c1 = new Cat();
            Cat c2 = new Cat();

            Console.WriteLine(Cat.count); //output 2
            //we must access static members using the class name. if we try to access them via an object of that class, we will generate an error
            //eg 3 - static methods can access only static members
            Dog.Bark(); //output Woof

            //Note - The Main method is static, as it is the starting point of any program. Therefore any method called directly from Main had to be static.

            //Note - Constant members are static by definition.
            //eg 4
            Console.WriteLine(MathClass.ONE); //output 1, remember static methods can access only static members, this shown const members are static by default since we access
                                              // the property ONE using the name of the class

            /*Static Constructor - constructors can be declared static to initialize static members of the class, the static constructor is automatically called once when
             * we access a statics member of the class.
             * */
            Console.WriteLine(SomeClass.X);
            Console.WriteLine(SomeClass.Y);


            /*
             * Static Classes - An entire class can be declared as static. A static class can contain only static members, You cannot instantiate an object of a static class
             * as only one instance of the static class can exist in a program.
             * Static classes are useful for combining logical properties and methods. A good example of this is the Math class. It contains various useful properties
             * and methods for mathematical operators. For example, the Pow method raises a number to a power:
             *
             */
            Console.WriteLine(Math.Pow(3, 2)); //output 9 i.e 3*3=9
                                               //we can access all members of the Math class using the class name, without declaring an object

            /*c# has some useful static methods and properties available , some of which are below
             * Math class - Math.PI, Math.E, Math.Max(), Math.Min(), Math.Abs(), Math.Sin(), Math.Cos(), Math.Pow(), Math.Round(), Math.Sqrt()
             * Array class - Array.Reverse(), Array.sort()
             * String class - String.Concat(), String.Equals()
             * DateTime class - DateTime.Now, DateTime.Today, DateTime.DaysInMonth(2016, 2)
             */
            int[] testArr = { 3, 2, 5, 6, 1, 4 };
            Array.Reverse(testArr);
            Array.Sort(testArr);

            string st1 = "some string";
            string st2 = " another string";

            Console.WriteLine(String.Concat(st1, st2));       //combines the two string
            Console.WriteLine(String.Equals(st1, st2));       //returns false as its not equal

            Console.WriteLine(DateTime.Now);                  //returns the current date and time
            Console.WriteLine(DateTime.Today);                //returns the current day
            Console.WriteLine(DateTime.DaysInMonth(2012, 2)); //return the number of days in the specified month
                                                              //The Console class is also an example of a static class, We use its static WriteLine() method to output to the screen, or the static ReadLine() method to get user input
                                                              //The Convert class used to convert value types is also a static class



            /* this and readonly
             * The this keyword
             * The this keyword is used inside the class and refers to the current instance of the class, meaning it refers to the current object.
             * One of the common uses of this is to distinguish class members from other data, such as local or formal parameters of a method. as shown in the
             * example on line(82);
             * here, this.name represents the member of the class, whereas name represents the parameter of the constructor.
             * Another common use of this is for passing the current instance to a method as parameter: ShowPersonInfo(this);
             *
             * The readonly Modifier
             * The readonly modifier prevents a member of a class from being modified after contruction. It means that the field declared as readonly can be modified
             * only when you declare it or from within a constructor.
             * example, see line(91)
             * if we try to modiify the name field anywhere else, we will get an error.
             * There are three major differences between readonly and const fields
             * 1 - A constant field must be initialized when it is declared, whereas a readonly field can be declared without initialization, as in:
             *       readonly string name; // ok
             *       const double PI; //error
             * 2 - A readonly field value can be changed in a constructor, but a constant value cannot
             * 3 - The readonly field can be assigned a value that is a result of a calculation, but constants cannot, as in:
             *        readonly double a = Math.Sin(60); //ok
             *        const double b = Math.Sin(60); // Error!
             */



            /*Indexers  -  An indexer allows objects to be indexed like an array
             * As discussed earlier, a string variable is actually an object of the String class. Further, the String class is actually an array of Char objects.
             * In this way, the string class implements an indexer so we can access any character (Char object)  by its index
             */
            string strg = "Hello World";
            char   x    = strg[4];

            Console.WriteLine(x); //output o   //Arrays use integer indexes, but indexers can use any type of index such as strings, characters etc

            /*Declaration of an indexer is to some extent similar to a property. The difference is that indexer accessors require an index.
             * Like a property, you use get and set accessors for defining an indexer. However, where properties return or set a specific data member,indexers
             * return or set a particular value from the object instance.
             * Indexers are defined with the this keyword.
             * for example, see line(101)
             * As you can see, the indexer definition includes the this keyword and an index, which is used to get and set the appropriate value.
             * Now when we declare an object of class Clients, we use an index to refer to specific objects like the elements of an array
             */
            Clients c = new Clients();

            c[0] = "Stan";
            c[1] = "iyke";
            Console.WriteLine(c[0]); //output  stan
            Console.WriteLine(c[1]); //output iyke
                                     //we typically use an indexer if the class represents a list, collection, or array of objects



            /*Operator Overloading
             * More operators in C# can be overloaded, meaning they can be redefined for custom actions.
             * For example, you can redefine the action of the plus(+) operator in a custom class.
             * Consider the Box class that has Height and Width properties
             * example in line(119)
             *
             *  Box b1 = new Box(14, 3);
             *  Box b2 = new Box(5, 7);
             *  we would like to add these two box objects, which would result in a new, bigger Box.
             *  So, basically, we would like the following code to work;
             *  Box b3 = b1 + b2;
             *  The height and width properties of object b3 should be equal to the sum of the properties of b1 and b2 objects.
             *  This is achieved through operator overloading
             *
             *  Overloaded operators are methods with special names, where the keyword operator is followed by the symbol for the operator beingdefined.
             *  Similar to any other method, an overloaded operator has a return type and a parameter list.
             *  example, line(119), for our box class, we overload the + operator
             *  The method (119) above defines an overloaded operator + with two Box object parameters and returning a new Box object whose Height and Width
             *  properties equal the sum of its parameter's corresponding properties.
             *  Additional, the overloaded operator must be static
             */
            Box b1 = new Box(14, 3);
            Box b2 = new Box(5, 7);
            Box b3 = b1 + b2;

            Console.WriteLine(b3.Height); //output 19
            Console.WriteLine(b3.Width);  //output 10
            //All arithmetic and comparison operators can be overloaded. For instance, you could define greater than and less than operators for the boxes
            //that would compare the Boxes and return a boolean result. Just keep in mind that when overloading the greater than operator, the less than
            //operator should also be defined
        }