Loading...

All Tips (11)

Logo CSharp
Differences between ref, out, and in parameters Steven Giesel | May 07, 2024
Are you familiar with the differences between ref, out, and in parameters in C#? They play a crucial role in controlling how data is passed between methods. Let's break it down:continue reading...

1️⃣ ref: Passes the argument by reference, allowing the method to read and modify the value. The variable must be initialized before being passed. You can also use this with reference types like string or your custom class.

2️⃣ out: Similar to ref, but the variable doesn't need to be initialized before being passed. The method must assign a value before it returns.

3️⃣ in: Passes the argument by reference, but the method can only read the value, not modify it. Useful for performance when passing large structs. It's not so useful if you pass in reference types.
Logo SQL
SQL Join Types Simplified khairy1999 | May 02, 2024
Joining tables is a fundamental skill in SQL that allows you to merge data from multiple tables based on common columns. Whether you’re a database developer, analyst, or SQL enthusiast, this simplified PDF guide will provide you with a clear understanding of SQL join types and empower you to unlock the full potential of your data.

Credits - @connect4techs.com
Logo CSS
All CSS Cursors thecodecrumbs | April 30, 2024
Credits - @thecodecrumbs
Logo CSharp
Use Exists instead of Any with collections Jalal Alzebda | April 23, 2024
✅ 𝗘𝘅𝗶𝘀𝘁𝘀 is a method that is available on collections like List and Array types. It checks whether an element that satisfies the condition exists in the list or array.
✅ 𝗔𝗻𝘆 is a LINQ method that works with any IEnumerable (which includes arrays, lists, and other collection types). It checks whether any element in the IEnumerable satisfies the condition.continue reading...

🚀 𝗘𝘅𝗶𝘀𝘁𝘀 is generally faster than Any. This is because Exists can take advantage of the internal implementation of List to perform the check more efficiently. Exists doesn't require the overhead of creating an enumerator that Any does.

💡 If you are working with collections other than List or Array, or if you want your code to work with any type of collection in the future, it's better to use 𝗔𝗻𝘆.
Logo JavaScript
Comparison between data containers in JavaScript programming language Bishir Tijjani | April 18, 2024
Credits: Theta Trainings 👏⭐💖

Follow Bishir Tijjani 😉🕺 for the most amazing content related to JavaScript, programming, ReactJS & Web Development
Logo CSharp
Fields 'readonly' Georgios Petas | April 16, 2024
Make fields '𝗿𝗲𝗮𝗱𝗼𝗻𝗹𝘆' when exclusively assigned in the constructor!

A field set only in a constructor without the readonly modifier may lead to ambiguity in its intended use.continue reading...

Marking such fields as readonly enhances clarity about their purpose.

The readonly modifier prevents unintentional alterations by future maintainers.

However, there are some 𝗲𝘅𝗰𝗲𝗽𝘁𝗶𝗼𝗻𝘀:

→ Fields declared in classes marked with the Serializable attribute.

→ Fields declared in partial classes.

→ Fields with attributes are ignored.

→ Fields of type struct that are not primitive or pointer types are also ignored because of possible unwanted behavior.
Logo CSharp
Use Guards and Fail Fast Poorna Soysa | April 11, 2024
𝗚𝘂𝗮𝗿𝗱 is a conditional statement to perform early input validation and detect problematic states, mitigating potential execution errors within a method.

The 𝗴𝘂𝗮𝗿𝗱 𝗰𝗹𝗮𝘂𝘀𝗲 runs before the main code, quickly checking if specific conditions are not met and 𝗳𝗮𝗶𝗹𝗶𝗻𝗴 𝗳𝗮𝘀𝘁 if necessary. It guards the rest of the code.continue reading...

✅ By checking for invalid input or problematic states at the beginning code becomes less cluttered and easier to follow, enhancing both code 𝗿𝗲𝗮𝗱𝗮𝗯𝗶𝗹𝗶𝘁𝘆 and 𝗺𝗮𝗶𝗻𝘁𝗮𝗶𝗻𝗮𝗯𝗶𝗹𝗶𝘁𝘆.
✅ This technique is highly effective for preventing deep conditional nesting, making the logic flow clearer and more transparent.

Do you use 𝗚𝘂𝗮𝗿𝗱𝘀 & 𝗙𝗮𝗶𝗹 𝗙𝗮𝘀𝘁 techniques in your code? 👇

🔄 If this is useful, 𝙧𝙚𝙥𝙤𝙨𝙩 to spread the knowledge.
👉 Follow Poorna Soysa and click the notification bell🔔on his likedin profile to receive notifications for all his upcoming posts.
Logo CSharp
Use Where before OrderBy Jalal Alzebda | April 04, 2024
🚀 In LINQ queries, the order in which you apply operations can affect performance. If you filter a collection using 𝗪𝗵𝗲𝗿𝗲 before sorting it with 𝗢𝗿𝗱𝗲𝗿𝗕𝘆, you reduce the number of items that need to be sorted. Sorting is generally more computationally expensive than filtering, so this can result in significant performance benefits, especially for larger collections.

🔥 This approach enhances performance because we're sorting a smaller subset of the original data.
Logo SQL
SQL Optimization Activity - Performance database Kadek Dwi Pradnyana | March 20, 2024
Here are some tips to help you enhance the performance of your SQL queries.
Logo jQuery
jQuery AJAX Example Nicolò Sonzogni | March 11, 2024
Here is first a jQuery AJAX example showing how to make an AJAX call in jQuery:
var jqxhr = 
    $.ajax({
       type: "POST",
       url: "/theServiceToCall.html",
       data: {
           name : "The name",
           desc : "The description"
        }
    })
    .done  (function(response, textStatus, jqXHR)    { alert("Success: " + response); })
    .fail  (function(jqXHR, textStatus, errorThrown) { alert("Error"); })
    .always(function(jqXHROrData, textStatus, jqXHROrErrorThrown)     { alert("complete"); })
    ;
Logo Visual Studio
Keyboard shortcuts in Visual Studio Microsoft | March 04, 2024