List of Posts written during Sep 2022

This is a list of of posts written during the month Sep 2022
(Rev. 10-May-2024)

Categories | About |     |  

List of Posts

This is the complete list of categories of posts written during Sep 2022. They have been ordered by the publish date, with the most recent first.

  1. Published: 01-Sep-2022
    An object reference might be null when your code calls a function or accesses a property. Programmers use an if-condition as a safety net and make a null-test on an object that has a possibility of being null at that point. The null conditional operators make it easier to write the code without the if-condition.

  2. Published: 04-Sep-2022
    Main method is the equivalent of the main method as we know in C language. It's the entry point of your program which means that it is the first function that executes when your program starts its execution. In this tutorial we learn the syntax of this function; we also learn about top-level statements that provide a shortcut to the main function.

  3. Published: 05-Sep-2022
    The concept of a property is the most widely used in dotnet programming. Properties provide setter and getter functions for validation of data before it enters or leaves your object. A property has a specific syntax that needs to be mastered.

  4. Published: 08-Sep-2022
    Value Types and Reference types are two types in C#. If you are familiar with C and C++, then you can think of reference types as that hold address of objects created on a heap memory. In contrast the value types hold an object. These concepts are far too complex for a beginner's tutorial. So I will try to explain them from a practical standpoint.

  5. Published: 11-Sep-2022
    An anonymous type is described by a comma separated properties clubbed into curly braces. The properties are readonly. The corresponding data-type is generated by the compiler. The name of the data-type remains unknown. It is not accessible in source code. Such types are called anonymous types. They are used to quickly store data without the need of defining a data-type. They are also used in query expressions.

  6. Published: 12-Sep-2022
    Functions in C# are usually called Methods. They can exist inside a class, struct, record - but not globally outside. So every function, including the Main function must be declared inside a class or a struct. In this tutorial we examine default arguments, named arguments, passing parameters by value and reference, the use of in keyword and finally passing unspecified number of arguments with the params keyword.

  7. Published: 13-Sep-2022
    In this tutorial we learn about delegates that are a data-type for a function signature. In this context a function signature includes the return type and the arguments of a function, but doesn't include the name. We also learn about lambda expressions and built-in delegates called Action and Func delegates.

  8. Published: 14-Sep-2022
    Inheritance in C# is similar to what we have in other object oriented languages. In this tutorial we take a short example to get introduced to the syntax. We also learn about the protected and sealed keywords.

  9. Published: 15-Sep-2022
    This tutorial is for explaining a few programs that exhibit the idea of polymorphism. I won't be able to go into the philosophy of polymorphism. The whole point of this tutorial is to introduce you to the syntax, and about how the usual things are done in a C# syntax.

  10. Published: 19-Sep-2022
    In this tutorial we shall set a project to use SQL Server as our database. You can obtain this project from the downloads attached to this video. But still I recommend that you go through this tutorial to ensure that everything is setup correctly on your specific machine. You might have to substitute your own connection string.

  11. Published: 19-Sep-2022
    EF Core provides logs that help us determine the time taken by a specific query to finish. The logs also display the actual SQL query that was executed on the database end. This means that we have a very transparent way of knowing the actual command in SQL syntax, and also about the time it took for completion. Hence we can diagnose queries that execute too slow - possibly because an index was missing on the database. In this tutorial we also examine how to use tags with logs.

  12. Published: 20-Sep-2022
    We shall use various methods to calulate the sum of prices of all the records in the items table. We will also take note of the times taken. Usually the best results are obtained if tracking is disabled for readonly queries and if SELECT is limited to just the columns needed and, if possible, by allowing the calculations to take place in the database. But keep in mind that each query has its own circumstances. So NEVER ASSUME RESULTS. TEST, TEST and TEST is the best way to determine the optimal query in each case.

  13. Published: 23-Sep-2022
    Lazy loading is a great O/RM pattern that AUTOMATICALLY loads dependent (child) data when it is first accessed. The delayed loading is both an advantage and a disadvantage. This tutorial explains both these aspects and the associated pitfalls. EF Core doesn't enable lazy loading by default.

  14. Published: 23-Sep-2022
    A query can first store the entire resultset into memory, and then use a foreach loop to process each item. Alternatively, it can stream each result into a foreach loop one by one. We examine both these possibilities in this tutorial.

  15. Published: 24-Sep-2022
    Suppose your database team have already provided you an optimized query in SQL syntax. Or let's say you have a legacy, old setup that makes it compulsory to run a query in raw SQL syntax. In such cases you can use the FromSqlRaw extension to make that call.

  16. Published: 26-Sep-2022
    Raw SQL queries and Stored Procedures can be executed with the FromSqlRaw extension. It is very common that these queries and procedures require parameters on the basis of values provided by a user. User-provided parameters are often a source of sql injection attacks. In this tutorial we learn how to pass parameters in a safe manner.

  17. Published: 27-Sep-2022
    EF Core uses batching to execute bulk updates in a single trip to the database. You can always fine-tune your code by carefully sequencing your statements so that ef core can batch them up. In the second part of this article we have a walkthrough to analyze a piece of code that triggers various trips to the database server, and we explain how that same code can be simplified and optimized to one single trip.

  18. Published: 28-Sep-2022
    A static class is a container for self-contained static functions that just operate on the input operators. The concept of a static class and static members is essentially the same as in other object oriented languages like C++ and Java. static classes provide simplicity but they are not a part of pure object oriented design. The general guidelines are to use static classes only SPARINGLY in your projects. In this tutorial we learn about the features of a static class in C#.

  19. Published: 28-Sep-2022
    Only one copy of a static data member exists in the entire program. A const member behaves like a static, but it's value is marked as fixed and constant. The compiler knows its value. Therefore it can make substitutions and avoid memory allocation for a const member. Let's see the finer details.