LINQ Study Note – 02

Three Actions In LINQ, we always work with objects, instead of the data source. Therefore, in the LINQ pattern, we always have three actions. Obtain the data source Create the query Execute the query Regarding the data source, the data source LINQ work with should support generic IEnumerable<T> interface; In other words, LINQ serves as…

LINQ Study Note – 01

LINQ works by using extension methods in C#, as LINQ won’t change the IEnumerator behind the scene. Func and Action Func type is common when we use LINQ to process, fetch and modify data or data collection in C#. Func itself can take 17 generic types as parameters. The last generic type parameter describes the…

Function Body Expression in C#

Function body expression is convenient when we make a less complicated function in C#. The body expression can decrease our workload dramatically when we are developing a large project. Original Function Function body Expression The function above is quite simple. It takes three parameters and returns the average value of the three parameters. The following…

Double and Float Tip in C#

I wrote a code snippet that day, and Visual Studio throws an error message regarding type conversation between Double and Float. This is the original code: As you can see, I declared a variable named number, and its data type is Float. The number’s value is 1.35. However, Visual Studio throws the error as: Literal…

Generic in C# – Basic Practice Example

Generic is a feature of C# programming language, which helps us save a lot of repeating works in our journey. It is efficient and widely used in practice. Background Imaging, we need to add many items into a list; and these items might be String, Integer, etc. Without Generic, we need to write at least…

Access Const Property in C#

In our development, we have to treat a Constant Property as a static member, if we need to reference this value. In other words, we have to access the member by using the type name, instead of the object name. Example The code snippet above is a Book class in a C# project. It has…

Case Study – Event Practice in C#

In C# practice, we always use Event as an observer for property modification. In this post, I am sharing a practice case regarding piggy bank monitoring. Background A piggy bank can help us with saving an amount of money that we planned. Every time, we deposit gold coins into the piggy bank, the balance will…

C# OOP Case Study: Initialization with a base parameter

I was studying my C# programming course material that day and came across an initialisation with a reference parameter. Case Background We are making a grade book for a student in his/her class. In the code, we are stimulating a scenario that we input the grade mark into his/her record. Every time, we input a…

C# Case Study – Delegate as a Method in Practice

Case Background A courier company ships parcels in the local area. There are four zones in the company’s business area. The shipping fees are a certain percentage of the given item price. Some destinations are a bit dangerous or far from the company’s depot, which has an additional risk fee $25. Zone 1 – 25%…

Refugee Stories – In Their Own Words

最近读了Refugee Stories – In Their Own Words这个本书,感触颇深。在书中的最后一章,介绍了澳大利亚的移民演变历史。我将它翻译出来,分享给大家。我本人不是专业的翻译人员,如果翻译错误,敬请谅解。 澳大利亚可以被称之为最成功的多元文化国家。 自第二次世界大战启,大约有800万移民定居澳大利亚,其中包括大约一百万难民。  在过去的七十年里,尽管有些移民不能被定义为难民,但很多移民来到澳大利亚是因为要逃离贫困,战后紧缩政策或者政治压迫。