Nutshell Series

Azure DevOps Directory Variables

Azure DevOps pipelines provide predefined variables to reference paths, workspaces, and directories consistently. Here’s a simplified two-column version for better mobile responsiveness:

Variable Description & Example Paths
$(Build.SourcesDirectory) Sources folder where repository code is checked out.

Linux: /home/vsts/work/1/s

Windows: C:\agent\_work\1\s

$(Build.ArtifactStagingDirectory) Folder used for staging build artifacts before publishing.

Linux: /home/vsts/work/1/a

Windows: C:\agent\_work\1\a

$(Build.BinariesDirectory) Folder where intermediate build outputs and binaries are placed.

Linux: /home/vsts/work/1/b

Windows: C:\agent\_work\1\b

$(Pipeline.Workspace) Root workspace directory for the pipeline run.

Linux: /home/vsts/work/1/

Windows: C:\agent\_work\1\

$(Agent.ToolsDirectory) Folder where agent stores cached tools and SDKs.

Linux: /home/vsts/work/1/c

Windows: C:\agent\_work\1\c

$(Agent.TempDirectory) Temporary folder used during pipeline execution.

Linux: /home/vsts/work/_temp

Windows: C:\agent\_work\_temp

$(Build.Repository.LocalPath) Local path where repository content is downloaded.

Linux: /home/vsts/work/1/s

Windows: C:\agent\_work\1\s

$(Agent.WorkFolder) Agent’s root work folder that contains all pipeline runs.

Linux: /home/vsts/work

Windows: C:\agent\_work

$(Agent.BuildDirectory) Build-specific directory (same as workspace root).

Linux: /home/vsts/work/1/

Windows: C:\agent\_work\1\

$(Agent.HomeDirectory) Directory where agent software is installed.

Linux: /home/vsts/agent

Windows: C:\agent

Reference: Azure DevOps Predefined Build Variables

Nutshell Series

Commonly Confused English Words Every Tech Professional Should Know

Communication in tech isn’t just about code — it’s also about clarity. Whether you’re writing documentation, naming variables, or emailing clients, using the right words can change how your message is understood. Many professionals, especially those who use English as a second language, find it challenging to distinguish between words that sound similar but mean completely different things.

This guide lists the most commonly confused English word pairs — like principal vs. principle — and explains why understanding their real meanings is crucial for global tech professionals who want to excel in their roles and communicate effectively.


Why It Matters for Non-Native English-Speaking Tech Professionals

  • Better Documentation: Precise language makes your technical documentation, code comments, and API references clearer for everyone.
  • Professional Communication: Emails, reports, and design proposals reflect your professionalism. The right word choice shows confidence and attention to detail.
  • Fewer Misunderstandings: In global teams, small differences in words can lead to big misunderstandings. Clarity ensures smooth collaboration.
  • Improved Code Clarity: Developers often use English for variable names, commit messages, and documentation. Knowing the difference between words like affect and effect makes your work more readable and precise.

Commonly Confused Word Pairs (and How to Remember Them)

Word Pair Meaning 1 Meaning 2 Example
Principal vs Principle Principal → Main or head of a school/project. Principle → Moral rule or belief. The principal engineer followed ethical principles.
Personal vs Personnel Personal → Private or individual. Personnel → Staff or employees. Keep your personal files separate from company personnel data.
Affect vs Effect Affect → To influence (verb). Effect → The result (noun). The outage affected performance; the effect was downtime.
Compliment vs Complement Compliment → Praise or kind remark. Complement → To complete or enhance. The UI design complements the backend logic — that’s a compliment to the dev team!
Stationary vs Stationery Stationary → Not moving. Stationery → Writing materials. The server rack is stationary, not stationery.
Assure vs Ensure vs Insure Assure → To make someone certain. Ensure → To make sure something happens.
Insure → To protect financially.
I assure you this patch will ensure stability and insure against data loss.
Discreet vs Discrete Discreet → Careful and tactful. Discrete → Separate or distinct. The system has discrete modules; be discreet with access logs.
Elicit vs Illicit Elicit → To draw out or evoke. Illicit → Illegal or forbidden. The test elicited a bug — not an illicit action!
Accept vs Except Accept → To receive or agree. Except → Excluding. We accept all pull requests except untested ones.
Advice vs Advise Advice → Suggestion (noun). Advise → To give advice (verb). Thanks for your advice; I’ll advise the team accordingly.
Imply vs Infer Imply → To suggest indirectly. Infer → To conclude from evidence. The tester implied the issue was fixed; we inferred it was safe to deploy.
Lose vs Loose Lose → To misplace or fail to win. Loose → Not tight or free. Don’t lose the config file or leave the cable loose.
Proceed vs Precede Proceed → To continue or move forward. Precede → To come before. Testing should proceed after deployment notes that precede it.

Tips to Remember

  • Say It Aloud: Similar-sounding words often differ in stress or rhythm — practice pronunciation to internalize differences.
  • Visualize Meaning: Picture the scenario where the word fits; for example, “stationery” brings pens and paper to mind.
  • Use in Code Comments: Practice correct usage when writing commit messages, documentation, or naming variables.
  • Keep a Mini Dictionary: Note down any confusing word pairs you encounter while reading technical blogs or documentation.

Being a great tech professional isn’t only about mastering frameworks and algorithms — it’s also about communicating precisely. For non-native English-speaking professionals, developing language accuracy builds confidence, improves collaboration, and strengthens your professional identity. Remember, the right word not only expresses your thoughts — it defines your clarity as a communicator and your excellence as an engineer.


Written for global tech professionals who believe that clarity in language is as essential as clarity in code.

Nutshell Series

🧩 Modern C# Operators and Syntax Cheatsheet (C# 6–12 & Beyond)

C# has evolved tremendously — from a verbose OOP language into a sleek, expressive, and modern programming language.
With each version, Microsoft introduced powerful operators that make code safer, more concise, and easier to read.
Here’s your ultimate guide to all the important operators you should know in modern C#.


🔹 1. Null-Coalescing & Safe Navigation

These operators help you handle null values gracefully without throwing exceptions.

Operator Example Description
?? var name = input ?? "Unknown"; Returns the right-hand value if the left-hand is null.
??= name ??= "Default"; Assigns a value only if the variable is null.
?. var len = person?.Name?.Length; Safely navigates through objects that may be null.
?[] var ch = text?[0]; Safely index into arrays or lists.
! obj!.ToString() Null-forgiving operator — tells the compiler “I know this isn’t null.”
is null / is not null if (value is null) Type-safe null comparison syntax.

🔹 2. Pattern Matching (C# 8–12)

Pattern matching enables powerful, declarative logic without repetitive if/else chains.

Pattern Example Description
is if (x is int i) Checks type and assigns if match succeeds.
is not if (obj is not string) Negated type match.
switch expression var area = shape switch { Circle c => c.Radius, Rectangle r => r.Width, _ => 0 }; Expression-based switch replacement.
Property pattern if (person is { Age: > 18, Name: not null }) Matches properties directly.
Tuple pattern (x, y) switch { (0, 0) => "Origin", (_, 0) => "X-axis" } Match multiple values together.
Relational pattern if (n is > 0 and < 10) Match numeric or range conditions.
List pattern (C# 11+) if (nums is [1, 2, .. var rest]) Match array/list structure.
Slice pattern if (arr is [1, .. var middle, 10]) Match prefix and suffix with ...

🔹 3. Expression & Lambda Enhancements

These operators make your code more concise and expressive.

Operator Example Description
=> public int Add(int x, int y) => x + y; Expression-bodied members.
() => () => DoWork() Lambda expression syntax.
_ _ = DoSomething(); Discard or wildcard variable.

🔹 4. Assignment & Arithmetic Shortcuts

Operator Example Description
+=, -=, *=, /=, %= x += 5; Compound assignments.
++ / -- count++; Increment or decrement.
<<, >>, >>> uint n = a >>> 1; Bit shift operators; >>> is unsigned right shift (C# 11).

🔹 5. Range & Index Operators (C# 8+)

Operator Example Description
^ var last = arr[^1]; Index from the end (1 = last element).
.. var sub = arr[1..4]; Slice between start and end indexes.
..^ arr[1..^1] Slice excluding first and last.

🔹 6. Type and Reflection Helpers

Operator Example Description
as obj as string Safe type cast, returns null if fails.
is if (obj is MyType) Checks runtime type.
typeof typeof(string) Gets type info at compile time.
nameof nameof(MyProperty) Gets identifier name as string.
default default(int) Returns default value of a type.

🔹 7. New Features in C# 12 / 13

Feature Example Description
Primary constructors class Person(string Name, int Age) Compact way to declare constructor + properties.
Collection expressions var list = [1, 2, 3]; Simpler syntax for new List<int> { 1, 2, 3 }.
Inline arrays Span<int> span = [1, 2, 3]; Allocate arrays inline without new.
Default lambda parameters (int x = 0) => x * 2 Lambdas with default argument values.
Params collections (C# 13) void Log(params string[] msgs) Flexible params syntax with collections.

💡 Quick Example


string? input = "";
string name = input ?? "Guest";      // null-coalescing
name ??= "Anonymous";                // assign if null

var len = name?.Length ?? 0;         // null-safe access
if (name is { Length: > 5 }) { }     // property pattern

var arr = [1, 2, 3, 4, 5];
var slice = arr[1..^1];              // [2,3,4]

var point = (x: 0, y: 0);
var message = point switch
{
    (0, 0) => "Origin",
    (_, 0) => "X-axis",
    _ => "Other"
};

Modern C# syntax lets you write expressive, safe, and elegant code with minimal boilerplate.
If you’re upgrading from older C# versions, take time to learn the ??, ?.,
pattern matching, and range operators — they’ll make your code cleaner and far more readable.

Stay updated with C# 13 and .NET 9 releases, as the language continues evolving toward simplicity and power!

Nutshell Series

⌨️ The Ultimate Keyboard Shortcuts Cheat Sheet (Windows, Office, Browser & Developer Tools)

Keyboard shortcuts are the secret weapon of productivity. They help you work faster, stay focused, and reduce mouse dependency. Whether you’re using Windows, Microsoft Office, browsers, or coding tools like Visual Studio and VS Code, this guide covers all the essential shortcuts you should know.


🧭 General Windows Shortcuts

  • Alt + Tab — Switch between open apps
  • Alt + F4 — Close active window or app
  • Win + D — Show or hide the desktop
  • Win + E — Open File Explorer
  • Win + R — Open “Run” dialog
  • Win + L — Lock your PC
  • Win + I — Open Settings
  • Win + S — Open Search
  • Win + A — Open Quick Settings panel (Wi-Fi, brightness, etc.)
  • Win + V — Open Clipboard history
  • Win + . — Open Emoji & symbol picker 😄
  • Win + Shift + S — Launch Snipping Tool for screenshots
  • Win + X — Open Power User Menu
  • Win + U — Open Accessibility options
  • Ctrl + Shift + Esc — Open Task Manager directly

🪟 Window Management Shortcuts

  • Win + ↑ / ↓ / ← / → — Snap or maximize windows
  • Win + Home — Minimize all except active window
  • Alt + Space — Open window control menu (Move, Close, etc.)
  • Alt + Enter — Show properties of selected item
  • Win + M — Minimize all windows
  • Win + Shift + M — Restore minimized windows
  • Win + Tab — Open Task View (virtual desktops)
  • Ctrl + Win + D — Create new virtual desktop
  • Ctrl + Win + ← / → — Switch between desktops
  • Ctrl + Win + F4 — Close current virtual desktop

💻 File Explorer Shortcuts

  • Alt + D — Focus address bar
  • Ctrl + E / F — Focus search box
  • Ctrl + N — Open new File Explorer window
  • Ctrl + Shift + N — Create new folder
  • Alt + ↑ — Go up one folder level
  • Alt + Left / Right — Navigate backward / forward
  • F2 — Rename selected file or folder
  • F3 — Search within File Explorer
  • Alt + Enter — View file properties
  • Ctrl + Shift + 2 — Change view to Large Icons (and similar view shortcuts)

🧩 Microsoft Office Shortcuts (Word, Excel, PowerPoint, Outlook)

  • Alt + R — Open Review tab (Spelling, Comments, Track Changes)
  • Ctrl + K — Insert hyperlink
  • Ctrl + Shift + M — New message (Outlook)
  • Ctrl + 1 / 2 / 3 — Switch Mail / Calendar / Contacts (Outlook)
  • Alt + Q — Search for commands (“Tell me what you want to do”)
  • F7 — Spell check and grammar
  • Ctrl + ; — Insert current date (Excel)
  • Ctrl + Shift + : — Insert current time (Excel)
  • Alt + = — AutoSum in Excel
  • Ctrl + Space — Select column (Excel)
  • Shift + Space — Select row (Excel)

🧠 Text Editing Shortcuts (Universal)

  • Ctrl + A — Select all
  • Ctrl + C / X / V — Copy / Cut / Paste
  • Ctrl + Z / Y — Undo / Redo
  • Ctrl + F / H — Find / Replace
  • Ctrl + Shift + → / ← — Select by word
  • Home / End — Move to start / end of line
  • Ctrl + Home / End — Move to start / end of document
  • Ctrl + Backspace — Delete previous word
  • Ctrl + Delete — Delete next word
  • Ctrl + Shift + V — Paste without formatting (works in most apps)

🌐 Browser Shortcuts (Edge, Chrome, Firefox)

  • Ctrl + T — New tab
  • Ctrl + W — Close current tab
  • Ctrl + Shift + T — Reopen last closed tab
  • Ctrl + Tab / Ctrl + Shift + Tab — Switch between tabs
  • Ctrl + L / Alt + D — Focus address bar
  • Ctrl + J — Open Downloads
  • Ctrl + H — Open History
  • Ctrl + Shift + Delete — Clear browsing data
  • Alt + Left / Right — Navigate Back / Forward
  • Ctrl + + / – — Zoom In / Out
  • F11 — Toggle full screen

💻 Visual Studio Shortcuts (C#, .NET, etc.)

  • Ctrl + Shift + B — Build solution
  • F5 — Start debugging
  • Ctrl + F5 — Run without debugging
  • Shift + F5 — Stop debugging
  • F9 — Toggle breakpoint
  • F10 / F11 — Step Over / Step Into
  • Ctrl + K, C — Comment selected lines
  • Ctrl + K, U — Uncomment selected lines
  • Ctrl + K, D — Format document
  • Ctrl + . — Quick Actions / Refactor
  • Ctrl + Shift + F — Find in entire solution
  • Alt + ↑ / ↓ — Move current line up/down

🧑‍💻 VS Code Shortcuts

  • Ctrl + P — Quick open file
  • Ctrl + Shift + P — Command palette
  • Ctrl + B — Toggle sidebar
  • Ctrl + ` — Toggle terminal
  • Ctrl + Shift + ` — Create new terminal
  • Alt + ↑ / ↓ — Move line up/down
  • Shift + Alt + ↓ — Copy line down
  • Ctrl + / — Comment/uncomment line
  • Ctrl + D — Select next occurrence
  • Ctrl + Shift + L — Select all occurrences
  • Ctrl + Space — Trigger IntelliSense
  • Ctrl + K, Z — Zen mode

⚙️ PowerShell / Command Line Shortcuts

  • Ctrl + L — Clear screen
  • Ctrl + C — Cancel current command
  • ↑ / ↓ — Browse command history
  • Tab — Auto-complete file or command name
  • Ctrl + Home / End — Jump to top / bottom of buffer
  • Ctrl + Shift + C / V — Copy / Paste in terminal

⚡ Power User & Productivity Tips

  • Win + Number (1–9) — Launch or switch to pinned taskbar apps
  • Ctrl + Shift + Esc — Direct Task Manager access
  • Alt + R — Review tools in Office apps for proofreading
  • Win + . — Use emojis and symbols anywhere (even Notepad!)
  • Ctrl + Shift + T — Your life-saver when you accidentally close a browser tab
  • Ctrl + Shift + N — New folder or Incognito mode depending on context

Mastering keyboard shortcuts is a game-changer for anyone working on a computer. Start with a few essentials, add new ones weekly, and soon you’ll navigate faster than ever before. Every second counts — and with these shortcuts, you’ll reclaim them!

Nutshell Series

Quick Guide to RESTful API Design Principles & Standards

This concise guide combines best practices to help you design clean, consistent, and scalable RESTful APIs.


⚙️ 1. Design Around Resources

  • Use nouns, not verbs — e.g., /users, /orders/{id}.
  • Keep URIs simple, consistent, and hierarchical.
  • Avoid exposing internal database details.

🧭 2. Use Correct HTTP Methods

Action Method Example
Read GET /orders
Create POST /orders
Update PUT or PATCH /orders/{id}
Delete DELETE /orders/{id}

Ensure idempotency for PUT and DELETE requests.

🧱 3. Stateless & Cacheable

  • Each request must contain all context — no server session state.
  • Use caching headers like ETag and Last-Modified where appropriate.

📄 4. Use Standard Representations

  • Prefer application/json as the default format.
  • Set proper headers:
    • Content-Type for request format
    • Accept for desired response format

🧩 5. Pagination & Filtering

  • Support ?limit=, ?offset=, or cursor-based pagination.
  • Allow filtering and sorting — e.g., ?status=active&sort=desc.

🔢 6. Versioning

  • Version via URI (e.g., /v1/) or headers.
  • Never break existing clients — evolve your API gracefully.

🚦 7. Status Codes & Errors

  • 200 – OK
  • 201 – Created
  • 204 – No Content
  • 400 – Bad Request
  • 404 – Not Found
  • 500 – Server Error

Return clear JSON error messages with a code and description.

📘 8. Documentation & Specification

  • Use OpenAPI (Swagger) or Postman Collections for design and documentation.
  • Document endpoints, parameters, request/response examples.
  • Mock and validate before implementation.

🧭 9. Consistency & Governance

  • Follow organization-wide conventions for naming, versioning, and error handling.
  • Maintain uniform design patterns — make every API feel familiar.

✅ 10. RESTful API Checklist

  • [ ] Resource-based URIs
  • [ ] Correct HTTP verbs
  • [ ] Stateless operations
  • [ ] Consistent JSON responses
  • [ ] Pagination and filtering support
  • [ ] Versioning strategy
  • [ ] Meaningful error format
  • [ ] OpenAPI documentation

💡 In Short

Design first, stay consistent, be consumer-friendly, and evolve safely.

Nutshell Series

Top Non-Microsoft NuGet Packages Every .NET Developer Should Know

When building applications with .NET Core or modern .NET (6, 7, 8, 9), you’ll often rely on powerful third-party libraries to simplify development, improve performance, and enhance maintainability. While Microsoft provides a robust foundation, the .NET ecosystem is enriched by an extensive range of open-source NuGet packages. Below is a comprehensive list of commonly used and highly recommended non-Microsoft libraries that can significantly boost your productivity and project quality.

1. Core Utilities & Helpers

  • LanguageExt – Brings functional programming concepts like Option, Either, and Try to C#. :contentReference[oaicite:0]{index=0}
  • MoreLinq – Extends LINQ with over 100 additional operators and utilities.
  • AutoMapper – Simplifies object-to-object mapping, ideal for DTOs and ViewModels. :contentReference[oaicite:1]{index=1}
  • CSharpFunctionalExtensions – Functional programming tools like Result and Maybe for clean error handling.
  • Humanizer – Makes text and time data more human-readable (e.g., “3 hours ago”).

2. Web Development & API

  • FluentValidation – Elegant and fluent model validation framework. :contentReference[oaicite:2]{index=2}
  • Swashbuckle.AspNetCore – Generates Swagger/OpenAPI documentation for ASP.NET Core APIs.
  • Sieve – Adds filtering, sorting, and pagination support to APIs via query parameters.
  • AspNetCoreRateLimit – Provides IP and client-based rate limiting for APIs.
  • Newtonsoft.Json – Popular JSON serialization library, still widely used for flexible handling.

3. Data Access & ORM

  • Dapper – Lightweight and super-fast micro ORM for raw SQL queries.
  • SqlKata – Fluent SQL query builder supporting multiple databases.
  • LiteDB – Embedded NoSQL database ideal for local or small-scale apps.
  • Z.EntityFramework.Plus.EFCore – Adds caching, auditing, and filters to EF Core.
  • Ardalis.Specification – Implements the specification pattern for repositories.

4. Security & Encryption

  • BCrypt.Net-Next – Provides secure password hashing using the bcrypt algorithm.
  • Sodium.Core – Modern cryptography library built on libsodium.
  • Jwt.Net – Helps create, sign, and validate JSON Web Tokens manually.

5. Logging & Monitoring

  • Serilog – The go-to structured logging framework for .NET. :contentReference[oaicite:3]{index=3}
  • Serilog.Sinks.Seq – Log viewer for Serilog (requires the Seq server).
  • Serilog.Sinks.Elasticsearch – Integrates logging directly with Elasticsearch.
  • App.Metrics – Tracks metrics, health checks, and application performance.

6. Testing & Mocking

  • xUnit – Widely used open-source testing framework.
  • NUnit – Classic and feature-rich test framework for .NET.
  • Moq – Most popular mocking library for unit testing.
  • NSubstitute – Simpler syntax alternative to Moq.
  • FluentAssertions – Provides human-readable, expressive assertions.
  • Verify – Enables snapshot testing for objects, APIs, and JSON outputs.

7. Dependency Injection & Architecture

  • Autofac – Advanced and flexible IoC container for .NET.
  • Scrutor – Assembly scanning and decoration utilities for DI.
  • ABP Framework – Modular application framework for enterprise apps.
  • FeatureToggle – Simple library for enabling or disabling features dynamically.

8. Caching & Performance

9. Messaging & Event Bus

  • MassTransit – Enterprise-grade distributed application messaging framework.
  • Rebus – Simple and lightweight service bus for .NE
Nutshell Series

Azure Bicep Cheat Sheet (2025)

What is Azure Bicep?

Bicep is a Domain Specific Language (DSL) for Azure Resource Manager. It simplifies ARM JSON templates into readable and modular code for Infrastructure as Code on Azure.

Basic Structure

@description('Storage account name')
param storageAccountName string
param storageSku string = 'Standard_LRS'

var location = resourceGroup().location

resource storageAccount 'Microsoft.Storage/storageAccounts@2023-01-01' = {
  name: storageAccountName
  location: location
  sku: {
    name: storageSku
  }
  kind: 'StorageV2'
}

output storageEndpoint string = storageAccount.properties.primaryEndpoints.blob

Parameters

@description('Admin username')
param adminUser string = 'azureuser'

@secure()
param adminPassword string

@allowed(['Standard_LRS', 'Standard_GRS'])
param sku string

Variables

var prefix = 'demo'
var uniqueName = '${prefix}${uniqueString(resourceGroup().id)}'
var subnetNames = ['web', 'app', 'db']

Expressions & Interpolation

var fullName = '${prefix}-${environment}-${location}'
var uniqueName = toLower(uniqueString(resourceGroup().id, 'key'))

Resource Declaration

resource myVnet 'Microsoft.Network/virtualNetworks@2023-01-01' = {
  name: 'vnet-${uniqueString(resourceGroup().id)}'
  location: location
  properties: {
    addressSpace: {
      addressPrefixes: ['10.0.0.0/16']
    }
  }
}

Resource Dependencies

Implicit dependency:

resource nic 'Microsoft.Network/networkInterfaces@2023-01-01' = {
  name: 'vmNic'
  properties: {
    ipConfigurations: [
      {
        name: 'ipconfig'
        properties: {
          subnet: { id: subnet.id }
        }
      }
    ]
  }
}

Explicit dependency:

dependsOn: [ nic, storageAccount ]

Loops

var subnets = [
  { name: 'web', prefix: '10.0.1.0/24' }
  { name: 'app', prefix: '10.0.2.0/24' }
]

resource vnet 'Microsoft.Network/virtualNetworks@2023-01-01' = {
  name: 'myVnet'
  properties: {
    addressSpace: { addressPrefixes: ['10.0.0.0/16'] }
    subnets: [for subnet in subnets: {
      name: subnet.name
      properties: { addressPrefix: subnet.prefix }
    }]
  }
}

Conditional Deployment

param enableDiagnostics bool = true

resource diag 'Microsoft.Insights/diagnosticSettings@2021-05-01-preview' = if (enableDiagnostics) {
  name: 'diagSetting'
  properties: {
    ...
  }
}

Modules

Main file:

module storage './storage.bicep' = {
  name: 'storageModule'
  params: {
    storageAccountName: 'mystorage'
    location: location
  }
}

storage.bicep:

param storageAccountName string
param location string

resource storage 'Microsoft.Storage/storageAccounts@2023-01-01' = {
  name: storageAccountName
  location: location
  sku: { name: 'Standard_LRS' }
  kind: 'StorageV2'
}

output storageId string = storage.id

Outputs

output storageId string = storage.id
output connectionString string = 'DefaultEndpointsProtocol=https;AccountName=${storage.name}'

Common Functions

  • resourceGroup() – Current resource group
  • uniqueString() – Deterministic unique ID
  • concat() – Join strings
  • length() – Array or string length
  • contains() – Checks if array contains value
  • if() – Inline condition
  • json() – Parse JSON

Azure CLI Commands

az deployment group create \
  --resource-group myRG \
  --template-file main.bicep \
  --parameters storageSku=Standard_LRS

az deployment group validate \
  --resource-group myRG \
  --template-file main.bicep

az deployment group what-if \
  --resource-group myRG \
  --template-file main.bicep

Scopes

targetScope = 'subscription'

resource rg 'Microsoft.Resources/resourceGroups@2023-01-01' = {
  name: 'myResourceGroup'
  location: 'eastus'
}

Best Practices

  • Use modules for reusable components
  • Validate parameters using @allowed, @minLength
  • Tag all resources consistently
  • Use loops instead of duplicate code
  • Preview changes using what-if
  • Avoid exposing secrets in outputs
  • Keep Bicep files under version control

Helpful CLI Commands

az bicep install
az bicep upgrade
az bicep build --file main.bicep
az bicep decompile --file template.json

Common Resource Types

  • Storage Account – Microsoft.Storage/storageAccounts@2023-01-01
  • Virtual Network – Microsoft.Network/virtualNetworks@2023-01-01
  • Virtual Machine – Microsoft.Compute/virtualMachines@2023-01-01
  • App Service – Microsoft.Web/sites@2023-01-01
  • Key Vault – Microsoft.KeyVault/vaults@2023-01-01
Nutshell Series

C# Delegates and Events – Explained

Delegates and events in C# are foundational concepts that enable flexible, type-safe method references and event-driven programming. Many developers find them confusing at first, but this guide explains them in a simple, easy-to-understand way.


What is a Delegate?

A delegate is a type-safe object that holds a reference to a method with a specific signature. Delegates are similar to function pointers in C or C++, but they are object-oriented, type-safe, and secure.

Delegates allow you to pass methods as parameters to other methods or assign methods at runtime.

// Define a delegate
public delegate int MathOperation(int x, int y);

// Method matching the delegate signature
public class Calculator
{
    public int Add(int a, int b) => a + b;
    public int Multiply(int a, int b) => a * b;
}

// Using the delegate
MathOperation operation = new Calculator().Add;
int result = operation(5, 3); // Output: 8

The delegate’s signature (return type + parameters) must match the method it references. This allows delegates to be used as **callbacks** or **pluggable methods** in your code.


Delegate Magic

Delegates are special objects. Unlike normal objects that contain data, a delegate only contains information about a method.
Delegates do not depend on the class of the object they reference; only the method signature matters.
This allows anonymous method invocation and runtime flexibility.


Benefits of Delegates

  • Type-safe: Ensures the method signature matches.
  • Object-oriented: Fully compatible with OOP principles.
  • Secure: No unsafe pointers.
  • Flexible: Can be used to pass methods around, define callbacks, and plug in new behavior dynamically.

Types of Delegates

C# delegates come in two main types:

1. Singlecast Delegate

A singlecast delegate points to a single method at a time.

public delegate void Notify(string message);

public class Messenger
{
    public void ShowMessage(string msg)
    {
        Console.WriteLine(msg);
    }
}

// Using singlecast delegate
Notify notify = new Messenger().ShowMessage;
notify("Hello World!"); // Only calls ShowMessage

2. Multicast Delegate

A multicast delegate can reference multiple methods. Delegates in C# are multicast by default and derived from System.MulticastDelegate.

public delegate void Notify(string message);

public class Messenger
{
    public void ShowMessage(string msg)
    {
        Console.WriteLine(msg);
    }

    public void LogMessage(string msg)
    {
        Console.WriteLine("Log: " + msg);
    }
}

Messenger m = new Messenger();
Notify notify = m.ShowMessage;
notify += m.LogMessage; // Add second method

notify("Hello World!");
// Output:
// Hello World!
// Log: Hello World!

Events in C#

An event is a mechanism that allows a class to notify other classes or objects when something happens.
Events are based on delegates and are widely used in GUI programming, data binding, and event-driven applications.

// Declare a delegate for the event
public delegate void ThresholdReachedEventHandler(int threshold);

// Class that publishes the event
public class Counter
{
    public event ThresholdReachedEventHandler ThresholdReached;
    private int total;

    public void Add(int x)
    {
        total += x;
        if (total >= 10)
        {
            ThresholdReached?.Invoke(total); // Trigger event
        }
    }
}

// Class that subscribes to the event
public class Listener
{
    public void OnThresholdReached(int value)
    {
        Console.WriteLine($"Threshold reached: {value}");
    }
}

// Usage
Counter counter = new Counter();
Listener listener = new Listener();

counter.ThresholdReached += listener.OnThresholdReached;
counter.Add(5);
counter.Add(6); // Triggers event

In this example, the Counter class fires the ThresholdReached event when a certain total is reached,
and the Listener responds to it.


Steps to Define and Use Delegates

  1. Declare a delegate with a method signature.
  2. Create methods matching the delegate signature.
  3. Create a delegate instance and assign methods.
  4. Invoke the delegate.
  5. (Optional) Use multicast delegates or events.

Summary Table

Concept Definition Example
Delegate Type-safe reference to a method MathOperation delegate
Singlecast Delegate Points to a single method Notify notify = messenger.ShowMessage;
Multicast Delegate Points to multiple methods notify += messenger.LogMessage;
Event Notifies other classes when something happens, based on delegates ThresholdReached event
Anonymous Delegate Delegate without a named method notify = delegate(string msg) { Console.WriteLine(msg); };
Callback Method passed via delegate to be called later MathOperation used as parameter
Nutshell Series

Object-Oriented Programming Concepts in C#

Object-Oriented Programming (OOP) helps us design applications using real-world concepts.
Below we explore important OOP principles and relationships in C#, along with examples.


Class

A Class is a blueprint that defines properties and methods.

public class Car
{
    public string Brand { get; set; }
    public void Drive()
    {
        Console.WriteLine($"{Brand} is driving.");
    }
}

Object

An Object is an instance of a class.

Car car1 = new Car { Brand = "Toyota" };
car1.Drive(); // Output: Toyota is driving.

Abstraction

Abstraction focuses on essential details while hiding the complexity.

public abstract class Payment
{
    public abstract void ProcessPayment(decimal amount);
}

public class CreditCardPayment : Payment
{
    public override void ProcessPayment(decimal amount)
    {
        Console.WriteLine($"Paid {amount} using Credit Card.");
    }
}

Encapsulation

Encapsulation hides implementation details using access modifiers.

public class BankAccount
{
    private decimal balance;

    public void Deposit(decimal amount) => balance += amount;
    public decimal GetBalance() => balance; // only controlled access
}

Polymorphism

Polymorphism allows the same method name to perform different tasks.

Overloading

public class Calculator
{
    public int Add(int a, int b) => a + b;
    public double Add(double a, double b) => a + b;
}

Overriding

public class Animal
{
    public virtual void Speak() => Console.WriteLine("Animal sound");
}

public class Dog : Animal
{
    public override void Speak() => Console.WriteLine("Bark");
}

Inheritance

Inheritance lets a class reuse properties and methods from a parent class.

public class Vehicle
{
    public void Start() => Console.WriteLine("Vehicle started");
}

public class Bike : Vehicle
{
    public void RingBell() => Console.WriteLine("Bell rings!");
}

Sealed Class

A sealed class cannot be inherited.

public sealed class Logger
{
    public void Log(string msg) => Console.WriteLine(msg);
}

Multiple Inheritance

C# does not allow multiple inheritance of classes, but interfaces provide it.

public interface IFly
{
    void Fly();
}

public interface ISwim
{
    void Swim();
}

public class Duck : IFly, ISwim
{
    public void Fly() => Console.WriteLine("Duck flying");
    public void Swim() => Console.WriteLine("Duck swimming");
}

Abstract Class

An abstract class cannot be instantiated directly; it must be inherited.

public abstract class Shape
{
    public abstract double Area();
}

public class Circle : Shape
{
    public double Radius { get; set; }
    public override double Area() => Math.PI * Radius * Radius;
}

Generalization

Generalization groups common features into a parent class.

public class Teacher : Person { }
public class Student : Person { }

public class Person
{
    public string Name { get; set; }
}

Association

Association represents a relationship between classes.

public class Customer
{
    public string Name { get; set; }
}

public class Order
{
    public Customer OrderedBy { get; set; }
}

Aggregation

Aggregation is a weak “whole-part” relationship.

public class Department
{
    public List Employees { get; set; } = new List();
}

public class Employee
{
    public string Name { get; set; }
}

Composition

Composition is a strong “whole-part” relationship. If the whole is destroyed, parts are also destroyed.

public class House
{
    private Room room;
    public House()
    {
        room = new Room(); // Room cannot exist without House
    }
}

public class Room { }

Multiplicity

Multiplicity defines how many objects can participate in a relationship.

public class Library
{
    public List Books { get; set; } = new List();
}

public class Book { }

Interface

An interface defines a contract without implementation.

public interface INotifier
{
    void Send(string message);
}

public class EmailNotifier : INotifier
{
    public void Send(string message)
    {
        Console.WriteLine($"Email sent: {message}");
    }
}

Summary Table

Concept Definition Example
Class Blueprint of objects Car
Object Instance of a class car1 = new Car()
Abstraction Focus on essentials Payment (abstract)
Encapsulation Data hiding BankAccount with private balance
Polymorphism Many forms Calculator.Add() overloads, Dog.Speak() override
Inheritance Reuse parent properties Bike inherits Vehicle
Sealed Class Cannot be inherited Logger
Multiple Inheritance Via interfaces Duck : IFly, ISwim
Abstract Class Must be inherited Shape
Generalization Group common features Person parent for Student, Teacher
Association Relationship Order → Customer
Aggregation Weak whole-part Department → Employees
Composition Strong whole-part House → Room
Multiplicity How many objects Library → Books
Interface Contract without implementation INotifier
Nutshell Series

Complete Guide to Service Status Pages of Popular services

When working with Microsoft cloud services such as Azure, Microsoft 365, Visual Studio, or GitHub or any other services, it’s important to know where to check the official status dashboards. These pages help you quickly confirm whether an issue is on your side or a wider service outage.

Below is a consolidated table of the official status and health pages you should bookmark.

Service Status Page Notes
Azure Azure Status Dashboard
Azure Service Health
Azure Resource Health
Global real-time status of all Azure services by region.
Service Health
Resource Health
Azure (Personalized) Azure Service Health (Portal) Requires login; shows service health specific to your subscriptions.
Microsoft 365 / Office 365 Microsoft 365 Admin Center Admin-only; covers Exchange Online, SharePoint, Teams, OneDrive, etc.
Microsoft 365 (Public) Microsoft Cloud Status Broad incidents affecting Microsoft 365 services.
Microsoft 365 Updates @MSFT365Status on X/Twitter Official updates on outages and recovery progress.
Visual Studio Visual Studio Service Status Tracks licensing and Visual Studio service availability.
Azure DevOps Azure DevOps Status Shows pipelines, repos, artifacts, and test plan health.
GitHub GitHub Status Monitors repositories, Actions, Codespaces, Packages, etc.
Dynamics 365 Dynamics 365 Status Service health and incidents for Dynamics 365 apps.
Power Platform Power Platform Status Real-time health for Power BI, Power Apps, Power Automate, and Power Virtual Agents.
Xbox Live Xbox Status Tracks Xbox Live, Game Pass, multiplayer, and account service health.
Office Connectivity Office Connectivity Status Office Connectivity
Jira / Atlassian Atlassian Status Page Tracks Jira, Confluence, Bitbucket, Trello, and other Atlassian cloud services.
Slack Slack Status Real-time status of messaging, calls, and integrations.
Google Workspace Google Workspace Status Shows health of Gmail, Drive, Docs, Calendar, Meet, and more.
AWS AWS Service Health Dashboard Regional health information for EC2, S3, RDS, Lambda, and other AWS services.
Zoom Zoom Status Monitors meetings, chat, phone, and webinar services.
Dropbox Dropbox Status Tracks cloud file storage and sync service health.
Salesforce Salesforce Status Service health for Sales Cloud, Service Cloud, Marketing Cloud, and more.
Zendesk Zendesk Status Tracks helpdesk, chat, and CRM services.

Why These Status Pages Matter

Whenever you face connectivity issues, sign-in failures, or downtime in Microsoft services, checking these official dashboards should be your first step. They help distinguish between a local setup problem and a wider outage.

Bookmark these links to save troubleshooting time and stay informed about Microsoft and GitHub service health.