<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Abhishek Adhav</title>
    <description>The latest articles on Forem by Abhishek Adhav (@abhishek_adhav_22ab0c2463).</description>
    <link>https://forem.com/abhishek_adhav_22ab0c2463</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2622261%2Fc721ed82-57d1-42a5-988d-805978bc7f3f.png</url>
      <title>Forem: Abhishek Adhav</title>
      <link>https://forem.com/abhishek_adhav_22ab0c2463</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/abhishek_adhav_22ab0c2463"/>
    <language>en</language>
    <item>
      <title>Unlocking Azure Blob Storage: A Developer’s Journey, Comparisons &amp; C# in Action</title>
      <dc:creator>Abhishek Adhav</dc:creator>
      <pubDate>Mon, 06 Oct 2025 13:30:41 +0000</pubDate>
      <link>https://forem.com/abhishek_adhav_22ab0c2463/unlocking-azure-blob-storage-a-developers-journey-comparisons-c-in-action-1pdl</link>
      <guid>https://forem.com/abhishek_adhav_22ab0c2463/unlocking-azure-blob-storage-a-developers-journey-comparisons-c-in-action-1pdl</guid>
      <description>&lt;p&gt;Many of us, when building apps and systems, don’t realize that where and how you store data is one of the most important decisions. It affects cost, performance, scale — and yes, profit. Whether you’re dealing with structured data (databases, rows &amp;amp; columns) or unstructured data (images, videos, logs, media files), there are tons of storage options — but some just work better than others depending on the situation.&lt;/p&gt;

&lt;p&gt;In this post, we’re going to zoom in on &lt;strong&gt;Azure Blob Storage&lt;/strong&gt;, a popular choice for storing unstructured data. Why? Because it scales really well, cost-friendly if used right, and it’s already being used in big stuff. For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;OpenAI uses Azure Blob Storage (with scaled accounts) to handle massive datasets, checkpoints, and global replication — letting them focus on AI rather than managing storage.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;DataCone (via Storware) backs up Exchange, OneDrive, SharePoint into Blob Storage — giving them scalable, secure archival and fast recovery.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So let’s get started &lt;/p&gt;

&lt;h2&gt;
  
  
  Concept
&lt;/h2&gt;

&lt;p&gt;Azure Blob Storage is Microsoft's cloud-based object storage solution, designed to handle vast amounts of unstructured data. Unlike traditional file systems, Blob Storage allows you to store data such as text, images, videos, backups, and logs in a scalable and cost-effective manner.&lt;/p&gt;

&lt;h3&gt;
  
  
  🧱Core Components of Azure Blob Storage
&lt;/h3&gt;

&lt;p&gt;Blob Storage is structured around three main components:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Storage Account: The top-level container that provides a unique namespace for your data. It serves as the entry point for accessing all your storage resources.&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw6vopplhu02gv5q3xdvz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw6vopplhu02gv5q3xdvz.png" alt="Storage Account" width="800" height="188"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Container: Within a storage account, containers help organize blobs into a flat namespace, similar to directories in a file system.&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvyn5bf1u4n54se2c6ajy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvyn5bf1u4n54se2c6ajy.png" alt="Container" width="800" height="244"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Blob: The actual data object stored within a container. Blobs can be of various types, each optimized for specific use cases.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffbcu20vxobwee0w6y6fr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffbcu20vxobwee0w6y6fr.png" alt="Blob" width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  🌐Accessing Blob Storage
&lt;/h3&gt;

&lt;p&gt;You can interact with Azure Blob Storage through various methods:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTTP/HTTPS: Access blobs directly over the web.&lt;/li&gt;
&lt;li&gt;Azure Storage REST API: Programmatically manage blobs using RESTful calls.&lt;/li&gt;
&lt;li&gt;Azure CLI &amp;amp; PowerShell: Command-line tools for managing storage resources.&lt;/li&gt;
&lt;li&gt;Azure SDKs: Client libraries available for languages like .NET, Java, Python, and Node.js.&lt;/li&gt;
&lt;li&gt;SFTP &amp;amp; NFS: Secure file transfer and network file system protocols for accessing blobs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;In this we will learn how to interact using .NET&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Comparision
&lt;/h2&gt;

&lt;p&gt;📊In the cloud market, two popular storage services are Azure Blob Storage and Amazon S3. Let's compare their features to understand when to use each.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Azure Blob Storage&lt;/th&gt;
&lt;th&gt;Amazon S3&lt;/th&gt;
&lt;th&gt;Why It Matters&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Storage Model&lt;/td&gt;
&lt;td&gt;Object storage with containers (blobs)&lt;/td&gt;
&lt;td&gt;Object storage with buckets&lt;/td&gt;
&lt;td&gt;Both are object storage services, but Azure uses containers while AWS uses buckets. This distinction can influence how you organize and manage your data.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Storage Costs (per GB/month)&lt;/td&gt;
&lt;td&gt;- Hot: $0.018&lt;br&gt;- Cool: $0.01&lt;br&gt;- Archive: $0.00135&lt;/td&gt;
&lt;td&gt;- Standard: $0.023&lt;br&gt;- Intelligent-Tiering: $0.023&lt;br&gt;- One Zone-IA: $0.01&lt;br&gt;- Glacier: $0.004&lt;br&gt;- Glacier Deep Archive: $0.00099&lt;/td&gt;
&lt;td&gt;Azure offers competitive pricing, especially for the Cool and Archive tiers. AWS provides a range of options, with Glacier Deep Archive being the most cost-effective for long-term storage.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data Transfer Costs (per GB)&lt;/td&gt;
&lt;td&gt;- Data In: Free&lt;br&gt;- Data Out: $0.087&lt;/td&gt;
&lt;td&gt;- Data In: Free&lt;br&gt;- Data Out: $0.09&lt;/td&gt;
&lt;td&gt;Both platforms offer free data ingress, but Azure's data egress costs are slightly lower, which can be beneficial for data-intensive applications.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Storage Tiers&lt;/td&gt;
&lt;td&gt;Hot, Cool, Archive (account-level tiering)&lt;/td&gt;
&lt;td&gt;Standard, Intelligent-Tiering, One Zone-IA, Glacier, Glacier Deep Archive (object-level tiering)&lt;/td&gt;
&lt;td&gt;Azure applies storage tiers at the account level, meaning all blobs in a container share the same tier. AWS allows for more granular control, enabling different objects within a bucket to have different storage classes.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Performance &amp;amp; Scalability&lt;/td&gt;
&lt;td&gt;High throughput with up to 20,000 IOPS per storage account; supports up to 500 requests per second per blob&lt;/td&gt;
&lt;td&gt;High throughput with support for at least 3,500 PUT and 5,500 GET requests per second per prefix&lt;/td&gt;
&lt;td&gt;Both services offer high scalability, but AWS's support for multiple prefixes can enhance performance in high-concurrency scenarios.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data Replication&lt;/td&gt;
&lt;td&gt;Locally Redundant Storage (LRS), Geo-Redundant Storage (GRS), Read-Access GRS (RA-GRS)&lt;/td&gt;
&lt;td&gt;Standard, Intelligent-Tiering, One Zone-IA, Glacier, Glacier Deep Archive (object-level tiering)&lt;/td&gt;
&lt;td&gt;Azure provides multiple replication options to ensure data durability and availability. AWS offers similar options but with different configurations and pricing structures.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Security &amp;amp; Compliance&lt;/td&gt;
&lt;td&gt;Advanced threat protection, encryption at rest and in transit, compliance with global standards&lt;/td&gt;
&lt;td&gt;Encryption at rest and in transit, access control policies, compliance with global standards&lt;/td&gt;
&lt;td&gt;Both platforms offer robust security features, but Azure's integration with Microsoft security tools and services may provide additional benefits for organizations already using Microsoft's ecosystem.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Access Control&lt;/td&gt;
&lt;td&gt;Azure Active Directory (AAD) integration, Shared Access Signatures (SAS)&lt;/td&gt;
&lt;td&gt;Identity and Access Management (IAM), Bucket Policies, Access Control Lists (ACLs)&lt;/td&gt;
&lt;td&gt;Azure's integration with AAD provides a unified identity management solution, which can simplify access control for organizations using Azure Active Directory.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h1&gt;
  
  
  Creation
&lt;/h1&gt;

&lt;h3&gt;
  
  
  1. Access the Azure Portal
&lt;/h3&gt;

&lt;p&gt;Go to &lt;a href="https://portal.azure.com" rel="noopener noreferrer"&gt;portal.azure.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvhqmt0sfeyungcvw9xxz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvhqmt0sfeyungcvw9xxz.png" alt="Azure Portal Homepage" width="800" height="438"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  2. Create a Storage Account
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;In the left menu, select &lt;strong&gt;Storage accounts&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwnjyt2pi4o2y45r4nu0a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwnjyt2pi4o2y45r4nu0a.png" alt="Create Storage Account Blade" width="800" height="415"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  3. Configure Basic Settings
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Subscription&lt;/strong&gt;: Choose your active subscription
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resource Group&lt;/strong&gt;: Select or create one
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Storage Account Name&lt;/strong&gt;: Use a unique name (3–24 lowercase letters/numbers)
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Region&lt;/strong&gt;: Pick your preferred Azure region
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance&lt;/strong&gt;: Choose &lt;strong&gt;Standard&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Account Kind&lt;/strong&gt;: Select &lt;strong&gt;StorageV2&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  4. Set Redundancy
&lt;/h3&gt;

&lt;p&gt;Choose based on durability needs:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Option&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;LRS&lt;/td&gt;
&lt;td&gt;Replicates within one region&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GRS&lt;/td&gt;
&lt;td&gt;Replicates to a secondary region&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RA-GRS&lt;/td&gt;
&lt;td&gt;Adds read access to secondary region&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ZRS&lt;/td&gt;
&lt;td&gt;Replicates across availability zones&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GZRS&lt;/td&gt;
&lt;td&gt;Combines ZRS + GRS&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RA-GZRS&lt;/td&gt;
&lt;td&gt;Adds read access to GZRS&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhbat1os5a2okeq0kd7lf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhbat1os5a2okeq0kd7lf.png" alt="Rdundancy" width="800" height="407"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  5. Configure Advanced Settings
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Access Tier&lt;/strong&gt;: Hot, Cool, or Archive
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Secure Transfer Required&lt;/strong&gt;: Enable
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hierarchical Namespace&lt;/strong&gt;: Enable for Data Lake Gen2&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6koza7xjxbqxwbzsb2ra.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6koza7xjxbqxwbzsb2ra.png" alt="Config" width="800" height="359"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Review and Create
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Review all settings
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create&lt;/strong&gt; to provision the storage account&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Your Account is Created&lt;/em&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  🔐 Enable SFTP Access
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Go to your &lt;strong&gt;Storage Account&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Under &lt;strong&gt;Settings&lt;/strong&gt;, select &lt;strong&gt;SFTP&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Toggle &lt;strong&gt;Enable SFTP&lt;/strong&gt; to &lt;strong&gt;Enabled&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Save&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Under SFTP settings, click &lt;strong&gt;Add user&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Provide a &lt;strong&gt;username&lt;/strong&gt; and assign &lt;strong&gt;permissions&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Save&lt;/strong&gt; to create the user&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  💸 SFTP Cost Analysis
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Item&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Cost Estimate&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Hourly&lt;/td&gt;
&lt;td&gt;$0.30/hour&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Monthly&lt;/td&gt;
&lt;td&gt;~$216 if enabled 24/7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Billing Note&lt;/td&gt;
&lt;td&gt;Charges apply even without usage&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Charges begin as soon as SFTP is enabled&lt;/strong&gt;, regardless of whether data is transferred.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Costs can accumulate quickly&lt;/strong&gt; if left running continuously.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  ✅ When to Use SFTP in Azure Blob Storage
&lt;/h3&gt;

&lt;p&gt;SFTP (Secure File Transfer Protocol) is ideal when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need to &lt;strong&gt;integrate legacy systems&lt;/strong&gt; that rely on SFTP for file exchange.&lt;/li&gt;
&lt;li&gt;You want to &lt;strong&gt;migrate data securely&lt;/strong&gt; from on-premises to Azure without rewriting existing tools.&lt;/li&gt;
&lt;li&gt;You’re working with &lt;strong&gt;third-party vendors&lt;/strong&gt; who require SFTP access for uploads/downloads.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  ⚠️ Best Practices to Optimize Cost
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Enable SFTP only when actively needed&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Disable SFTP when idle&lt;/strong&gt; to avoid unnecessary charges
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitor usage and billing&lt;/strong&gt; regularly in the Azure Portal&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Implementation
&lt;/h1&gt;

&lt;p&gt;Let Understand it's integration with .net and how we can store the file&lt;/p&gt;

&lt;h2&gt;
  
  
  Access &amp;amp; Configuration Setup in .NET
&lt;/h2&gt;

&lt;p&gt;Before writing blob code, you need to configure how your .NET application will access Azure Blob Storage—this includes credentials, app settings, and dependency injection.&lt;/p&gt;

&lt;p&gt;🔐 a) Store Your Connection Info (or Use Identity)&lt;br&gt;
You have a few options to authenticate your .NET app with Azure Blob Storage.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffy5dn1dixz359huvcfq8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffy5dn1dixz359huvcfq8.png" alt="Credential" width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔑 Connection String / Account Key&lt;br&gt;
Store the connection string in appsettings.json, environment variables, or Azure App Service settings.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "ConnectionStrings": {
    "AzureBlob": "DefaultEndpointsProtocol=https;AccountName=yourAccount;AccountKey=yourKey;EndpointSuffix=core.windows.net"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🛡️ Managed Identity / Azure AD / TokenCredential&lt;br&gt;
For better security, use Azure AD or Managed Identity (especially if hosted in Azure). This avoids storing secrets in config.&lt;/p&gt;

&lt;p&gt;⚙️ Using Microsoft.Extensions.Azure Helpers&lt;br&gt;
If you're using ASP.NET Core or a generic host, register BlobServiceClient via DI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;builder.Services.AddAzureClients(clientBuilder =&amp;gt;
{
    clientBuilder.AddBlobServiceClient(builder.Configuration.GetSection("Azure:Storage:Blob"));
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then inject BlobServiceClient wherever needed.&lt;/p&gt;

&lt;p&gt;🧩 b) Wiring in Program.cs / Startup&lt;/p&gt;

&lt;p&gt;In a typical ASP.NET Core app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var builder = WebApplication.CreateBuilder(args);

// Bind configuration
builder.Services.AddControllers();

// Register Blob client via DI
builder.Services.AddAzureClients(clients =&amp;gt;
{
    clients.AddBlobServiceClient(builder.Configuration.GetSection("Azure:Storage:Blob"));
});

var app = builder.Build();
app.Run();


appsettings.json Example
{
  "Azure": {
    "Storage": {
      "Blob": {
        "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=...;AccountKey=...;EndpointSuffix=core.windows.net"
      }
    }
  }
}

Injecting the Client
public class MyService
{
    private readonly BlobServiceClient _blobServiceClient;

    public MyService(BlobServiceClient blobServiceClient)
    {
        _blobServiceClient = blobServiceClient;
    }

    // ...
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;📦 Storage / Blob Operations in .NET&lt;br&gt;
Once access is configured, here are common ways to store and manage blobs.&lt;/p&gt;

&lt;p&gt;🧱 a) Basic Operations: Upload, Download, List, Delete&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Using Azure.Storage.Blobs SDK (v12+):
using Azure.Storage.Blobs;
using Azure.Storage.Blobs.Models;

public async Task UploadFileAsync(string containerName, string localFilePath)
{
    BlobContainerClient container = _blobServiceClient.GetBlobContainerClient(containerName);
    await container.CreateIfNotExistsAsync(PublicAccessType.None);

    string fileName = Path.GetFileName(localFilePath);
    BlobClient blob = container.GetBlobClient(fileName);

    await blob.UploadAsync(localFilePath, overwrite: true);
}

public async Task DownloadFileAsync(string containerName, string blobName, string downloadPath)
{
    BlobContainerClient container = _blobServiceClient.GetBlobContainerClient(containerName);
    BlobClient blob = container.GetBlobClient(blobName);
    await blob.DownloadToAsync(downloadPath);
}

public async Task&amp;lt;List&amp;lt;string&amp;gt;&amp;gt; ListBlobsAsync(string containerName)
{
    BlobContainerClient container = _blobServiceClient.GetBlobContainerClient(containerName);
    var names = new List&amp;lt;string&amp;gt;();
    await foreach (BlobItem item in container.GetBlobsAsync())
    {
        names.Add(item.Name);
    }
    return names;
}

public async Task DeleteBlobAsync(string containerName, string blobName)
{
    BlobContainerClient container = _blobServiceClient.GetBlobContainerClient(containerName);
    BlobClient blob = container.GetBlobClient(blobName);
    await blob.DeleteIfExistsAsync();
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🚀 Advanced Storage Patterns in Azure Blob Storage
&lt;/h2&gt;

&lt;p&gt;Depending on your scenario, Azure Blob Storage offers multiple blob types and access strategies. Here's a breakdown:&lt;/p&gt;

&lt;h3&gt;
  
  
  🧱 Blob Types
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Blob Type&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Use Case&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Block Blobs&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Default type. Ideal for storing files, documents, images, and backups.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Append Blobs&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Optimized for append-only operations like logging or telemetry data.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Page Blobs&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Supports random read/write access. Used for virtual hard disks (VHDs) and VM disks.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h3&gt;
  
  
  🔐 Access Strategies
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Strategy&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Purpose&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;SAS Tokens&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Generate scoped, time-limited access for clients without exposing account keys.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Streaming Uploads&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Upload directly from memory, streams, or web requests—no need for local files.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Chunked Uploads&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Upload large files in blocks for better performance and reliability.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h3&gt;
  
  
  🧰 Example Use Cases
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Block Blob&lt;/strong&gt;: Uploading user profile images or PDFs
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Append Blob&lt;/strong&gt;: Writing logs from a web app or IoT device
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Page Blob&lt;/strong&gt;: Hosting a VHD for an Azure VM
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SAS Token&lt;/strong&gt;: Sharing a file securely with a third party
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Streaming Upload&lt;/strong&gt;: Saving a file from an HTTP request directly to blob
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Chunked Upload&lt;/strong&gt;: Handling 5GB+ video files with retry logic&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  🧾 Final Thoughts
&lt;/h1&gt;

&lt;p&gt;This is one way to integrate Azure Blob Storage in .NET. Depending on your app type (web, console, microservice), hosting environment (Azure App Service, AKS, VM), and security needs, you can adapt the approach.&lt;br&gt;
There are many ways to do this—what matters is choosing the right one for your scenario.&lt;br&gt;
Thanks for reading! 🙌&lt;br&gt;
Let me know in the comments how you’re using Blob Storage in your projects or if you’d like a follow-up on performance tuning, SAS tokens, or Data Lake Gen2.&lt;/p&gt;

&lt;p&gt;Let me know if you'd like help turning this into a downloadable guide or adding diagrams for architecture and flow. You're building a solid technical resource!&lt;/p&gt;

</description>
      <category>cloudcomputing</category>
      <category>azure</category>
      <category>dotnet</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>Ultimate Guide to OOP Interview Questions for C#</title>
      <dc:creator>Abhishek Adhav</dc:creator>
      <pubDate>Fri, 19 Sep 2025 16:32:07 +0000</pubDate>
      <link>https://forem.com/abhishek_adhav_22ab0c2463/ultimate-guide-to-oop-interview-questions-for-c-3bng</link>
      <guid>https://forem.com/abhishek_adhav_22ab0c2463/ultimate-guide-to-oop-interview-questions-for-c-3bng</guid>
      <description>&lt;p&gt;As you're aware, OOP (Object-Oriented Programming) is foundational in enterprise software development. Whether you're working in C#, Java, or C++, mastering OOP is essential—not just for writing maintainable code, but also for performing well in technical interviews. Below are some of the most commonly asked OOP interview questions, focused on C# but also applicable in simpler forms to Java and C++&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Explain what are four pillar of OOPS?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Ans :- The four foundational principles—commonly referred to as the four pillars of Object-Oriented Programming&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Encapsulation&lt;/strong&gt;
Encapsulation is the practice of bundling data (attributes) and the methods that operate on that data into a single class, while also restricting access to the internal representation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As an SDE, you'll often use encapsulation to ensure that your objects expose only what they need to—through controlled interfaces (like getBalance() and deposit(amount)), while keeping the sensitive state (like balance) private and protected. This keeps the system modular, secure, and maintainable&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class BankAccount {
  private double balance;

  public double getBalance() { return balance; }
  public void deposit(double amount) {
    if (amount &amp;gt; 0) balance += amount;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Inheritance&lt;/strong&gt;
Inheritance allows a class (child) to derive properties and methods from another class (parent), enabling code reuse, logical hierarchy formation, and extensibility.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In enterprise systems, inheritance helps you create clean hierarchies (e.g., Vehicle → Car, Vehicle → Motorcycle) allowing you to define shared behavior once, then specialize as needed—minimizing duplication and enhancing maintainability&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Vehicle { 
  public void startEngine() { 
     Console.WriteLine("Vehicle Start");
  } 
}
class Car extends Vehicle {
  void openTrunk() {
     Console.WriteLine("Car Truck Open"); 
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Abstraction&lt;/strong&gt;
Abstraction focuses on presenting essential features while hiding unnecessary implementation details. It typically manifests via abstract classes or interfaces that define a contract but not the full implementation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When designing systems—say, a Smart Home API with generic Device operations—it allows you to present a clean interface (turnOn(), turnOff()) across varied device types, with each device implementing the behavior. This enables clarity, flexibility, and extensibility&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;abstract class Device {
  abstract void turnOn();
  abstract void turnOff();
}
class Light extends Device { ... }
class Thermostat extends Device { ... }`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Polymorphism&lt;/strong&gt;
Polymorphism means “many forms.” It allows objects to be treated as instances of their parent class while invoking method implementations that are specific to the actual subtype. It can be compile-time (method overloading) or runtime (method overriding).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In practical scenarios, polymorphism makes your code flexible and generically extensible. For example, a collection of Shape objects can call draw() on each shape, and the correct behavior (circle drawing vs rectangle drawing) happens automatically&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Shape { void draw() { ... } }
class Circle extends Shape { @Override void draw() { ... } }
Shape s = new Circle();
s.draw(); // Executes Circle’s draw()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why This Order Makes Sense for SDE Interviewers&lt;/strong&gt;&lt;br&gt;
Essentially, it means you start by protecting your data (encapsulation), then reuse and organize it with hierarchies (inheritance), hide the details behind clean interfaces (abstraction), and finally let your code adapt to different behaviors when needed (polymorphism).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Explain difference between abstraction and encapsulation ?&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Ans :- Both are two different concept and has a diffrent purpose&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Abstraction&lt;/strong&gt;: Focuses on what a class does by hiding the underlying complexity and exposing only the necessary behavior.&lt;br&gt;
Privatizing the inner workings and wrapping it in a public shell so details can change without impacting how it’s used.&lt;/p&gt;

&lt;p&gt;Defines what an object should do, without revealing how it’s implemented:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public abstract class Shape
{
    public abstract double Area();
}

public class Circle : Shape
{
    public double Radius { get; set; }
    public override double Area() =&amp;gt; Math.PI * Radius * Radius;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Users call Area() without knowing the calculation details.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Encapsulation&lt;/strong&gt;: Focuses on how a class protects its internal data by bundling it with methods and restricting direct access.Binding data and operations into a class, hiding the internals with access modifiers while exposing a controlled public interface.&lt;br&gt;
Protects internal state and ensures controlled access:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class BankAccount
{
    private decimal balance;

    public void Deposit(decimal amount)
    {
        if (amount &amp;gt; 0) balance += amount;
    }

    public decimal GetBalance() =&amp;gt; balance;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The balance field is private and can be changed only via validated methods.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Explain different type of Polymorphism?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Ans :- This question can be ask in different why like Explain compile time polymorphism (static) and run time(Dynamic) polymorphism. Here is the detail explanation of it .&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Compile-Time Polymorphism (Static Polymorphism)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What it is: The method to call is determined at compile time.&lt;br&gt;
How it's done: Typically via method overloading (same method name, different parameters) or operator overloading.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class MathOps
{
    public int Add(int a, int b) =&amp;gt; a + b;
    public float Add(float a, float b) =&amp;gt; a + b;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, the correct Add method is selected by the compiler based on argument types.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run-Time Polymorphism (Dynamic Polymorphism)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What it is: The method to call is determined at runtime, based on the object’s actual type.&lt;br&gt;
How it's done: Through method overriding using &lt;strong&gt;virtual&lt;/strong&gt; and &lt;strong&gt;override&lt;/strong&gt; keywords with inheritance.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class Animal
{
    public virtual void Speak() =&amp;gt; Console.WriteLine("Animal speaks");
}

public class Dog : Animal
{
    public override void Speak() =&amp;gt; Console.WriteLine("Dog barks");
}

Animal pet = new Dog();
pet.Speak();  // Outputs: "Dog barks"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, the program decides at runtime to call Dog’s Speak() override.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Explain what access modifiers and its type?&lt;/strong&gt;&lt;br&gt;
 Ans :- Access modifiers are special keywords in C# that determine who can see or use certain parts of your code—whether it's within the same class, the same assembly (project), or anywhere in the application. They play a key role in encapsulation, ensuring that only the right parts of your code are exposed or hidden.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;public: Accessible from anywhere—across classes and assemblies.&lt;/li&gt;
&lt;li&gt;private: Accessible only within the same class.&lt;/li&gt;
&lt;li&gt;protected: Accessible within the same class and derived classes.&lt;/li&gt;
&lt;li&gt;internal: Accessible only within the same assembly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. Explain difference between abstract class and interface?&lt;/strong&gt;&lt;br&gt;
 Ans :-&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Abstract Class&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;An abstract class is a class that cannot be instantiated on its own; it must be subclassed. It can have both abstract methods (methods without implementation) and normal methods (methods with implementation).&lt;/p&gt;

&lt;p&gt;Abstract methods: These are methods that are declared but have no implementation. They are meant to be overridden by subclasses.&lt;/p&gt;

&lt;p&gt;Normal methods: These are methods that have a complete implementation in the abstract class and can be used as is by the subclasses.&lt;/p&gt;

&lt;p&gt;Key points about Abstract Class:&lt;/p&gt;

&lt;p&gt;Can have both abstract and normal methods.&lt;/p&gt;

&lt;p&gt;Can have member variables (fields) and constructors.&lt;/p&gt;

&lt;p&gt;Can provide a partial implementation of methods, meaning some methods are implemented, but others are left abstract for subclasses to define.&lt;/p&gt;

&lt;p&gt;A class can only inherit from one abstract class (single inheritance).&lt;/p&gt;

&lt;p&gt;Example of an Abstract Class:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;abstract class Animal {
    // Abstract method (no implementation)
    public abstract void makeSound();

    // Normal method (with implementation)
    public void sleep() {
        System.out.println("The animal is sleeping.");
    }
}

class Dog extends Animal {
    // Implementing the abstract method
    public void makeSound() {
        System.out.println("Bark!");
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Interface&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;An interface is a contract or blueprint that specifies what methods a class must implement, but it cannot provide any implementation itself (though some languages now allow default method implementations in interfaces). All methods in an interface are abstract by default.&lt;/p&gt;

&lt;p&gt;No implementation in interface: The methods in an interface only declare what methods the implementing class should have, but they do not provide any functionality themselves.&lt;/p&gt;

&lt;p&gt;Cannot have instance variables: Unlike an abstract class, an interface cannot have member variables (fields). It can only declare constants (static final fields).&lt;/p&gt;

&lt;p&gt;Can be implemented by any class: A class can implement multiple interfaces (multiple inheritance), which is one key advantage over abstract classes.&lt;/p&gt;

&lt;p&gt;Key points about Interface:&lt;/p&gt;

&lt;p&gt;Only abstract methods (no method bodies unless it's a default method in some languages).&lt;/p&gt;

&lt;p&gt;Cannot have constructors or instance variables.&lt;/p&gt;

&lt;p&gt;Supports multiple inheritance (a class can implement multiple interfaces).&lt;/p&gt;

&lt;p&gt;Used when you want to define a common set of methods for classes that might not share a common ancestor.&lt;/p&gt;

&lt;p&gt;Example of an Interface:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;interface Animal {
    void makeSound(); // Abstract method with no implementation
}

class Dog implements Animal {
    public void makeSound() {
        System.out.println("Bark!");
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;6.Explain virtual and override keyword?&lt;/strong&gt;&lt;br&gt;
Ans :-&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;virtual Keyword
Used in the base class.
Marks a method that can be overridden in derived classes.
Allows a method to have a default implementation, but it can be changed in subclasses.&lt;/li&gt;
&lt;li&gt;override Keyword:
Used in the derived class.
Replaces the implementation of a virtual method from the base class.
Ensures the method in the derived class has a new implementation.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;using System;
class Animal
{
    // Virtual method: can be overridden by derived classes
    public virtual void MakeSound()
    {
        Console.WriteLine("Some generic animal sound");
    }
}

class Dog : Animal
{
    // Override the virtual method to provide specific implementation
    public override void MakeSound()
    {
        Console.WriteLine("Bark!");
    }
}

class Program
{
    static void Main()
    {
        Animal myDog = new Dog(); // Polymorphism: Animal reference, Dog object
        myDog.MakeSound(); // Output: Bark!
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;7. What is the difference between method overloading and method overriding?&lt;/strong&gt;&lt;br&gt;
Ans:&lt;br&gt;
&lt;strong&gt;Method Overloading&lt;/strong&gt;&lt;br&gt;
Occurs at compile time. You define multiple methods in the same class with the same name but different signatures (different number or types of parameters). Overloading is a way to provide multiple ways to call a method.&lt;br&gt;
Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Calculator {
    public int Add(int a, int b) { return a + b; }
    public double Add(double a, double b) { return a + b; }
    public int Add(int a, int b, int c) { return a + b + c; }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Method Overriding&lt;/strong&gt;&lt;br&gt;
Occurs at runtime (dynamic polymorphism). A derived class provides its specific implementation of a method that’s already defined in base class (which is marked virtual, abstract, or override in further parent). To override, you use the override keyword in the derived class.&lt;br&gt;
Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Animal {
    public virtual void Speak() { Console.WriteLine("Animal sound"); }
}
class Dog : Animal {
    public override void Speak() { Console.WriteLine("Bark"); }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;8. What is the sealed keyword in C#, and when would you use it?&lt;/strong&gt;&lt;br&gt;
Ans:-&lt;br&gt;
The sealed keyword can be used in two main contexts:&lt;/p&gt;

&lt;p&gt;Sealing a class: If you mark a class as sealed, it cannot be inherited. No class can derive from that class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public sealed class FinalClass {
  public void DoSomething() { … }
}
// public class Derived : FinalClass { } // Not allowed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sealing an override method: In a derived class, if you override a virtual method, you can mark that override as sealed override. This prevents further derived classes from overriding that method again.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Base {
  public virtual void Display() { … }
}
class Intermediate : Base {
  public sealed override void Display() { … }
}
class FurtherDerived : Intermediate {
  // public override void Display() { … }  // Not allowed
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When to use sealed:&lt;/p&gt;

&lt;p&gt;To prevent inheritance where it doesn’t make sense or might cause incorrect use.&lt;/p&gt;

&lt;p&gt;To lock down behavior for security or consistency.&lt;/p&gt;

&lt;p&gt;Sometimes for performance reasons (sealed classes are optimized better by compiler/JIT in some cases).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9. What are value types vs reference types in C#? Give examples.&lt;/strong&gt;&lt;br&gt;
Ans:&lt;br&gt;
&lt;strong&gt;Value Types&lt;/strong&gt;&lt;br&gt;
Stored in the stack (or inline in containing objects)&lt;br&gt;
When you assign one value-type variable to another, it copies the value (they are independent)&lt;br&gt;
Examples: int, double, bool, struct, enum&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reference Types&lt;/strong&gt;&lt;br&gt;
Stored as references (the value is a reference/pointer) to data stored in the heap&lt;br&gt;
When you assign one reference-type variable to another, both reference the same object. Changes via one variable reflect in the other.&lt;br&gt;
Examples: class objects, string (though it's immutable), arrays, delegates&lt;br&gt;
Why it matters: memory usage; behavior of assignment; garbage collection; performance implications (boxing / unboxing when converting between value/reference types).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10. What is a static class in C#? How is it different from a regular class?&lt;/strong&gt;&lt;br&gt;
Ans:-&lt;br&gt;
A static class in C# is a class that:&lt;br&gt;
Cannot be instantiated (you can’t create an object using new).&lt;br&gt;
All its members (methods, properties, fields) must be static.&lt;br&gt;
Is implicitly sealed. You cannot derive from a static class.&lt;br&gt;
Differences vs regular class:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Regular class&lt;/strong&gt;: you can create instances; can have both static and non-static members; subclasses possible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Static class:&lt;/strong&gt; only static members; no instances; no inheritance; often used for utility/helper functionality or grouping related static operations.&lt;br&gt;
Example use case: Methods like Math.Sqrt(), or utility methods in a helper class that don’t need object state.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>csharp</category>
      <category>oop</category>
    </item>
    <item>
      <title>SOLID Principle</title>
      <dc:creator>Abhishek Adhav</dc:creator>
      <pubDate>Sat, 28 Dec 2024 16:52:25 +0000</pubDate>
      <link>https://forem.com/abhishek_adhav_22ab0c2463/solid-principle-in-net-core-1am0</link>
      <guid>https://forem.com/abhishek_adhav_22ab0c2463/solid-principle-in-net-core-1am0</guid>
      <description>&lt;p&gt;&lt;strong&gt;What are SOLID Principle&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The SOLID principles are design principles aimed at creating more understandable, flexible, and maintainable software. These principles can help improve the design of the application and improving the structure of an software applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Following are the five SOLID principle.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Single Responsibility Principle (SRP)&lt;/li&gt;
&lt;li&gt;Open/Closed Principle (OCP)&lt;/li&gt;
&lt;li&gt;Liskov Substitution Principle (LSP)&lt;/li&gt;
&lt;li&gt;Interface Segregation Principle (ISP)&lt;/li&gt;
&lt;li&gt;Dependency Inversion Principle (DIP)
We will understand all of this in detail.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;em&gt;Single Responsibility Principle (SRP)&lt;/em&gt;&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Definition :- Every class should have only one reason to change.&lt;/p&gt;

&lt;p&gt;SRP suggest that one class should have only one responsibility means every class, module, or function in a program should have one responsibility/purpose in a program. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4nltmsj23oibmzsbzv2h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4nltmsj23oibmzsbzv2h.png" alt="Image description" width="800" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Above code snippet violate the SRP principle  StudentRegistration have two responsibility.&lt;/p&gt;

&lt;p&gt;We can fix this by separating the logic for RegisterStudent and Calculate_Student_Result in different class.   &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Few9v2seu1la1bjkkl52y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Few9v2seu1la1bjkkl52y.png" alt="Image description" width="800" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Merits of SRP:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Improved maintainability and easier testing due to focused, single-responsibility classes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Demerits of SRP:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Can lead to over-engineering with an increased number of classes and added complexity for simple applications.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Open/Closed Principle (OCP)&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Definition :- Software entities (classes, modules, functions, etc.) should be open for extension but closed for modification&lt;/p&gt;

&lt;p&gt;OCP in simple words say that once created class or function should be closed for further modification means once the class is correctly working no addition logic should be added to the class. But open for extension means one can extend the implementation (of a class or function) of logic and/or functionality by using Inheritance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2bk8fzh9767lvpuqfvyf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2bk8fzh9767lvpuqfvyf.png" alt="Image description" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the above example if we want to add another type of customer we will have to change the class DiscountCalculator. which violate the rule. &lt;br&gt;
This can be resolve by introducing new Interface which will  defines a CalculateDiscount method, which each customer class will implement.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frkzwa11j8cuh281rbrk2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frkzwa11j8cuh281rbrk2.png" alt="Image description" width="800" height="446"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now in this scenario the DiscountCalculator class will never be modified but will be used for extension .&lt;/p&gt;

&lt;p&gt;Merits of Open/Closed Principle:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enhances flexibility by allowing extensions without modifying existing code, promoting maintainability.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Demerits of Open/Closed Principle:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Can lead to increased complexity and a larger number of classes due to the need for abstraction and extensions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Liskov Substitution Principle (LSP)&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Definition :- It states that objects of a superclass should be replaceable with objects of a subclass without affecting the correctness of the program.&lt;/p&gt;

&lt;p&gt;In other words, subtypes must be substitutable for their base types without altering the desirable properties of the program, such as correctness, behavior, or functionality.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F98aidspt4fdo2ac06zlr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F98aidspt4fdo2ac06zlr.png" alt="Image description" width="800" height="487"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the above code the LSP principle is follow as the object of object of Shape can be replaceable by Square class and it not breaking the behavior of the program.&lt;/p&gt;

&lt;p&gt;Merits of Liskov Substitution Principle (LSP):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enhances code reusability and maintainability by ensuring subclasses can be substituted for base classes without altering the program’s correctness.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Demerits of Liskov Substitution Principle (LSP):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;May lead to overly complex hierarchies if not applied carefully, potentially causing confusion or unnecessary abstraction.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Interface Segregation Principle (ISP)&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Definition :- The Interface Segregation Principle (ISP) states that clients should not be forced to depend on interfaces they do not use.&lt;br&gt;
In other words, rather than having a large, all-encompassing interface, it's better to break it down into smaller, more specific interfaces. This ensures that a class or client only needs to implement or depend on the methods that are relevant to them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwhgy7gzvjttvd9ltju5j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwhgy7gzvjttvd9ltju5j.png" alt="Image description" width="800" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Both Engineer and Designer are forced to implement methods that may not be relevant to their job role. For example, a Designer might not need to implement Eat() or Sleep() methods in a real-world scenario, but the large interface forces them to do so.&lt;/p&gt;

&lt;p&gt;The solution is to split the large IWorker interface into smaller, more specific interfaces, so each class only implements the methods it truly needs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo4floosac6kr2yec3xxz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo4floosac6kr2yec3xxz.png" alt="Image description" width="800" height="485"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Merits of ISP:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Improves maintainability, flexibility, and testability by ensuring classes only depend on the methods they use.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Demerits of ISP:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Increases the number of interfaces to manage and may lead to unnecessary abstraction.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Dependency Inversion Principle (DIP)&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Definition :- High-level modules should not depend on low-level modules. Both should depend on abstractions.&lt;/p&gt;

&lt;p&gt;This principle encourages decoupling of high-level logic (business rules) from low-level details (implementation). Instead of the high-level module directly depending on the low-level module, both should depend on abstractions (like interfaces or abstract classes).&lt;/p&gt;

&lt;p&gt;Below example show the tight couple of high level module with low-level module&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiveshrp2mgtvee1varzm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiveshrp2mgtvee1varzm.png" alt="Image description" width="800" height="487"&gt;&lt;/a&gt;&lt;br&gt;
The NotificationService is directly dependent on EmailService. If we want to change the email implementation (e.g., switch to SMS or push notification), we must modify the NotificationService class, violating the DIP.&lt;br&gt;
Here is a solution&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1puhvwqil7uq3gnts7w6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1puhvwqil7uq3gnts7w6.png" alt="Image description" width="800" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now The NotificationService class depends on IMessageService, not on a specific low-level implementation like EmailService. It receives the IMessageService dependency via constructor injection.&lt;/p&gt;

&lt;p&gt;Merits of DIP:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Improves flexibility, maintainability, and testability by decoupling high-level and low-level modules through abstractions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Demerits of DIP:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Increases complexity due to the need for abstractions and dependency injection.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;SO this are the five SOLID principle which is used for clean coding and can be followed in any programming language  &lt;/p&gt;

</description>
      <category>csharp</category>
      <category>netcore</category>
      <category>cleancoding</category>
      <category>design</category>
    </item>
  </channel>
</rss>
