<?xml version="1.0" encoding="UTF-8" standalone="no"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" version="2.0">

<channel>
	<title>Dot Net Guide</title>
	<atom:link href="https://www.dotnetguide.com/feed/" rel="self" type="application/rss+xml"/>
	<link>https://www.dotnetguide.com/</link>
	<description>A Complete Dot Net Guide</description>
	<lastBuildDate>Mon, 28 Apr 2025 04:15:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://www.dotnetguide.com/wp-content/uploads/2019/12/cropped-dotnetguide-1-32x32.png</url>
	<title>Dot Net Guide</title>
	<link>https://www.dotnetguide.com/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<itunes:explicit>no</itunes:explicit><itunes:subtitle>A Complete Dot Net Guide</itunes:subtitle><item>
		<title>C# 12 Features You Should Be Using in 2025</title>
		<link>https://www.dotnetguide.com/c-12-features/</link>
					<comments>https://www.dotnetguide.com/c-12-features/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 15 Apr 2025 05:52:04 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://www.dotnetguide.com/?p=1634</guid>

					<description><![CDATA[<p>C# 12, released with .NET 8, brings a host of new features aimed at improving developer productivity, code clarity, and application performance. Whether you&#8217;re building enterprise software, microservices, or modern web apps, understanding these features will help you write better C# code. 🚀 What&#8217;s New in C# 12? C# 12 includes: We’ll explore each of ... </p>
<p class="read-more-container"><a title="C# 12 Features You Should Be Using in 2025" class="read-more button" href="https://www.dotnetguide.com/c-12-features/#more-1634">Read more<span class="screen-reader-text">C# 12 Features You Should Be Using in 2025</span></a></p>
<p>The post <a href="https://www.dotnetguide.com/c-12-features/">C# 12 Features You Should Be Using in 2025</a> appeared first on <a href="https://www.dotnetguide.com">Dot Net Guide</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>C# 12, released with .NET 8, brings a host of new features aimed at improving developer productivity, code clarity, and application performance. Whether you&#8217;re building enterprise software, microservices, or modern web apps, understanding these features will help you write better C# code.</p>



<figure class="wp-block-image size-full"><a href="https://www.dotnetguide.com/wp-content/uploads/2025/04/C-12-Features.jpg"><img fetchpriority="high" decoding="async" width="626" height="324" src="https://www.dotnetguide.com/wp-content/uploads/2025/04/C-12-Features.jpg" alt="C# 12 Features" class="wp-image-1640" srcset="https://www.dotnetguide.com/wp-content/uploads/2025/04/C-12-Features.jpg 626w, https://www.dotnetguide.com/wp-content/uploads/2025/04/C-12-Features-300x155.jpg 300w" sizes="(max-width: 626px) 100vw, 626px" /></a></figure>



<h3 class="wp-block-heading" id="h-what-s-new-in-c-12">🚀 What&#8217;s New in C# 12?</h3>



<p>C# 12 includes:</p>



<ul class="wp-block-list">
<li><strong>Primary Constructors</strong></li>



<li><strong>Collection Expressions</strong></li>



<li><strong>Interceptors</strong> <em>(experimental)</em></li>



<li><strong>Interpolated String Handlers</strong></li>



<li><strong>Default Lambda Parameters</strong></li>



<li><strong>Static Abstract Members in Interfaces</strong></li>



<li><strong>Required Members</strong></li>



<li><strong>UTF-8 String Literals</strong></li>
</ul>



<p>We’ll explore each of these in detail with examples, comparisons, and real-world use cases.</p>



<h2 class="wp-block-heading" id="h-primary-constructors"><strong>Primary Constructors</strong></h2>



<p>Primary constructors allow you to declare constructor parameters directly in the class or struct definition, simplifying initialization and reducing boilerplate code.</p>



<h3 class="wp-block-heading">Traditional Constructor (Pre-C# 12)</h3>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
public class Person
{
    public string Name { get; }
    public int Age { get; }

    public Person(string name, int age)
    {
        Name = name;
        Age = age;
    }
}
</pre></div>


<h3 class="wp-block-heading">Using Primary Constructor (C# 12)</h3>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
public class Person(string name, int age)
{
    public string Name { get; } = name;
    public int Age { get; } = age;
}
</pre></div>


<p>In the C# 12 example, the constructor parameters <code>name</code> and <code>age</code> are declared directly in the class definition, and then assigned to the properties. This approach reduces redundancy and enhances readability.​</p>



<p><strong>Benefits:</strong></p>



<ul class="wp-block-list">
<li><strong>Conciseness:</strong> Reduces the amount of code needed for property initialization.​</li>



<li><strong>Readability:</strong> Keeps constructor parameters and property assignments close together.​</li>



<li><strong>Maintainability:</strong> Simplifies updates to constructor parameters and property assignments.</li>
</ul>



<p><strong>Potential Pitfalls:</strong></p>



<ul class="wp-block-list">
<li><strong>Mutability:</strong> In non-record types, primary constructor parameters are mutable and do not automatically generate public properties.​</li>



<li><strong>Compatibility:</strong> Ensure your project targets .NET 8 or later to use primary constructors.</li>
</ul>



<h4 class="wp-block-heading">💡 Use Case:</h4>



<ul class="wp-block-list">
<li>Great for <strong>services</strong> and <strong>models</strong> in ASP.NET Core where constructor injection is common.</li>
</ul>



<h4 class="wp-block-heading">⚠️ Gotchas:</h4>



<ul class="wp-block-list">
<li>In non-record types, constructor parameters are <strong>mutable</strong>.</li>



<li>Properties are <strong>not automatically generated</strong>, unlike in records.</li>
</ul>



<h4 class="wp-block-heading">📌 Pro Tip:</h4>



<p>Add <code>readonly</code> to parameters or fields to ensure immutability:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
public class Config(string name)
{
    public string Name { get; } = name;
}
</pre></div>


<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><strong>Collection Expressions</strong></h2>



<p>C# 12 introduces collection expressions, enabling a concise syntax for initializing collections.​</p>



<h3 class="wp-block-heading">Traditional Collection Initialization</h3>



<pre class="wp-block-preformatted"><code>var numbers = new List&lt;int> { 1, 2, 3, 4, 5 };<br></code></pre>



<h3 class="wp-block-heading">Using Collection Expressions (C# 12)</h3>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
var numbers = &#x5B;1, 2, 3, 4, 5];
</pre></div>


<p>This new syntax simplifies collection initialization, making the code more readable and concise.​</p>



<p><strong>Benefits:</strong></p>



<ul class="wp-block-list">
<li><strong>Simplicity:</strong> Reduces the verbosity of collection initialization.​</li>



<li><strong>Clarity:</strong> Enhances the readability of code involving collections.​</li>
</ul>



<p><strong>Compatibility:</strong></p>



<ul class="wp-block-list">
<li>Collection expressions require<a href="https://dotnet.microsoft.com/en-us/learn/dotnet/what-is-dotnet" target="_blank" rel="noreferrer noopener"> .NET</a> 8 or later.​</li>
</ul>



<h4 class="wp-block-heading">💡 Use Case:</h4>



<ul class="wp-block-list">
<li>Perfect for initializing test data, mock objects, or quick list generation.</li>



<li>Can be used in <code><strong>params</strong></code> and <strong>LINQ queries</strong>.</li>
</ul>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
int Sum(params int&#x5B;] values) =&gt; values.Sum();
Console.WriteLine(Sum(&#x5B;1, 2, 3])); // Outputs 6
</pre></div>


<h4 class="wp-block-heading">📌 Pro Tip:</h4>



<p>Use it for cleaner <strong>in-line function calls</strong> with array arguments.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading"><strong>Interceptors</strong></h2>



<p>Interceptors in C# 12 allow method call redirection, enabling optimized versions of methods to replace generalized ones. This feature is particularly useful in scenarios like logging, validation, or performance monitoring.​</p>



<p><strong>Example:</strong></p>



<p>Suppose you have a method <code>Calculate</code> that you want to intercept for logging purposes.​</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
&#x5B;InterceptsLocation(&quot;Program.cs&quot;, line: 10, character: 5)]
public static int CalculateInterceptor()
{
    Console.WriteLine(&quot;Calculate method intercepted.&quot;);
    return 42; // Optimized result
}
</pre></div>


<p>In this example, calls to the <code>Calculate</code> Methods at the specified location are intercepted and redirected to <code>CalculateInterceptor</code>.​</p>



<p><strong>Benefits:</strong></p>



<ul class="wp-block-list">
<li><strong>Optimization:</strong> Allows replacing generalized methods with optimized versions.​</li>



<li><strong>Flexibility:</strong> Enables cross-cutting concerns like logging or validation without modifying the original method.​</li>
</ul>



<p><strong>Caution:</strong></p>



<ul class="wp-block-list">
<li><strong>Experimental Feature:</strong> Interceptors are currently experimental and may be subject to change in future releases.​</li>



<li><strong>Complexity:</strong> Improper use of interceptors can lead to code that is difficult to understand and maintain.</li>
</ul>



<h4 class="wp-block-heading">💡 Use Case:</h4>



<ul class="wp-block-list">
<li>AOP (aspect-oriented programming) scenarios like logging, validation, and performance tracking.</li>



<li>Replace complex proxy/decorator patterns.</li>
</ul>



<h4 class="wp-block-heading">⚠️ Gotchas:</h4>



<ul class="wp-block-list">
<li><strong>Experimental</strong> in .NET 8 — subject to change.</li>



<li>Debugging intercepted calls may be tricky.</li>
</ul>



<h2 class="wp-block-heading"><strong>Interpolated String Handlers</strong></h2>



<p>These handlers improve performance when using string interpolation, especially in logging scenarios where expensive formatting operations can be avoided.</p>



<h4 class="wp-block-heading">✅ Example:</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
logger.LogDebug($&quot;User ID: {user.Id}, Name: {user.Name}&quot;);
</pre></div>


<p>Behind the scenes, C# now allows conditional string building that only happens if the logging level is enabled.</p>



<h4 class="wp-block-heading">💡 Benefit:</h4>



<ul class="wp-block-list">
<li>Prevents unnecessary string allocations.</li>



<li>Makes logging cleaner and faster.</li>
</ul>



<h4 class="wp-block-heading">📌 Pro Tip:</h4>



<p>Use it with Microsoft.Extensions.Logging to avoid performance hits in production logs.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading" id="h-default-lambda-parameters"><strong>Default Lambda Parameters</strong></h2>



<p>You can now define default parameter values for lambdas, improving reusability and reducing code repetition.</p>



<h4 class="wp-block-heading">✅ New in C# 12</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
Func&lt;int, int&gt; square = (int x = 2) =&gt; x * x;
Console.WriteLine(square()); // Outputs: 4
</pre></div>


<h4 class="wp-block-heading">❌ Before C# 12</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
Func&lt;int, int&gt; square = (x) =&gt; x * x;
Console.WriteLine(square(2));
</pre></div>


<h4 class="wp-block-heading">💡 Use Case:</h4>



<ul class="wp-block-list">
<li>Default logic handlers</li>



<li>Unit testing with optional parameters</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading" id="h-static-abstract-members-in-interfaces"><strong>Static Abstract Members in Interfaces</strong></h2>



<p>Now interfaces can declare static members, enabling generic math and strongly-typed factory methods.</p>



<h4 class="wp-block-heading">✅ Example:</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
Interface IAddable&lt;T&gt;
{
    static abstract T Add(T a, T b);
}

struct Calculator : IAddable&lt;int&gt;
{
    public static int Add(int a, int b) =&gt; a + b;
}
</pre></div>


<h4 class="wp-block-heading">💡 Use Case:</h4>



<ul class="wp-block-list">
<li>Generic math libraries</li>



<li>Consistent static API definitions</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading" id="h-required-members"><strong>Required Members</strong></h2>



<p>Specify that certain properties must be initialized during object creation.</p>



<h4 class="wp-block-heading">✅ Example:</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
public class Product
{
    public required string Name { get; set; }
    public decimal Price { get; set; }
}

var p = new Product { Name = &quot;Laptop&quot;, Price = 899.99m }; // ✅
</pre></div>


<h4 class="wp-block-heading">❌ Forgetting Required Property</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
var p = new Product { Price = 899.99m }; // ❌ Compile-time error
</pre></div>


<h4 class="wp-block-heading">💡 Use Case:</h4>



<ul class="wp-block-list">
<li>Enforces object validity</li>



<li>Prevents uninitialized model data</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading" id="h-utf-8-string-literals"><strong>UTF-8 String Literals</strong></h2>



<p>Now you can explicitly define UTF-8 string literals, improving performance and clarity in systems dealing with encoding.</p>



<h4 class="wp-block-heading">✅ Example:</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
ReadOnlySpan&lt;byte&gt; greeting = &quot;Hello&quot;u8;
</pre></div>


<h4 class="wp-block-heading">💡 Use Case:</h4>



<ul class="wp-block-list">
<li>APIs that communicate over the network</li>



<li>Interoperability with native code</li>
</ul>



<h2 class="wp-block-heading"><strong>Comparison with Previous Versions</strong></h2>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Feature</th><th>Pre-C# 12 Syntax</th><th>C# 12 Syntax</th></tr></thead><tbody><tr><td>Constructor Declaration</td><td>Separate constructor method</td><td>Constructor parameters in class definition</td></tr><tr><td>Collection Initialization</td><td><code>new List&lt;int&gt; { 1, 2, 3 }</code></td><td><code>[1, 2, 3]</code></td></tr><tr><td>Method Interception</td><td>Manual implementation using delegates or proxies</td><td>Declarative interception using attributes</td></tr></tbody></table></figure>



<h2 class="wp-block-heading" id="h-net-8-vs-net-9-compatibility"><strong>.NET 8 vs .NET 9 Compatibility</strong></h2>



<p>Something like:</p>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Feature</th><th>C# 12 with .NET 8</th><th>C# 12 with .NET 9</th></tr></thead><tbody><tr><td>Primary Constructors</td><td>✅ Supported</td><td>✅ Supported</td></tr><tr><td>Interceptors</td><td>⚠️ Experimental</td><td>✅ Improved</td></tr><tr><td>UTF-8 Literals</td><td>✅</td><td>✅</td></tr></tbody></table></figure>



<h3 class="wp-block-heading">Real-World Use Case: ASP.NET Core DI + C# 12</h3>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
public class HomeController(ILogger&lt;HomeController&gt; logger)
{
    public IActionResult Index()
    {
        logger.LogInformation(&quot;C# 12 rocks!&quot;);
        return View();
    }
}
</pre></div>


<p>No constructor body needed! Works seamlessly with .NET DI system.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<figure class="wp-block-image size-full"><a href="https://www.dotnetguide.com/wp-content/uploads/2025/04/Untitled-design.png"><img decoding="async" width="626" height="324" src="https://www.dotnetguide.com/wp-content/uploads/2025/04/Untitled-design.png" alt="C# 12 primary constructor syntax comparison" class="wp-image-1636" srcset="https://www.dotnetguide.com/wp-content/uploads/2025/04/Untitled-design.png 626w, https://www.dotnetguide.com/wp-content/uploads/2025/04/Untitled-design-300x155.png 300w" sizes="(max-width: 626px) 100vw, 626px" /></a></figure>



<h2 class="wp-block-heading" id="h-additional-c-12-features-you-shouldn-t-miss"><strong>Additional C# 12 Features You Shouldn’t Miss</strong></h2>



<h3 class="wp-block-heading">Experimental Attribute</h3>



<p>C# 12 introduces the <code>ExperimentalAttribute</code>, allowing developers to mark APIs as experimental. This attribute helps in signaling that certain features or APIs are not yet stable and may change in future releases.​</p>



<h4 class="wp-block-heading">✅ Example:</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
&#x5B;Experimental(&quot;EXP001&quot;)]
public void ExperimentalFeature()
{
    // Implementation
}

</pre></div>


<p>This feature is particularly useful for library authors who want to introduce new functionalities without committing to a stable API contract immediately.​</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">📏 Inline Arrays</h3>



<p>Inline arrays are a new feature in C# 12 that allows the definition of fixed-size arrays within structs. This can lead to performance improvements by reducing heap allocations and improving data locality.​</p>



<h4 class="wp-block-heading">✅ Example:</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
&#x5B;System.Runtime.CompilerServices.InlineArray(5)]
public struct FixedArray
{
    private int _element0;
}
</pre></div>


<p>This feature is beneficial in scenarios where performance is critical, such as game development or high-performance computing.​</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">🔍 Pattern Matching Enhancements</h3>



<p>C# 12 brings improvements to pattern matching, including extended property patterns and the ability to use patterns in more contexts. This allows for more expressive and concise code when working with complex data structures.</p>



<h4 class="wp-block-heading">✅ Example:</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
if (person is { Age: &gt; 18, Name: &quot;Alice&quot; })
{
    Console.WriteLine(&quot;Eligible&quot;);
}
</pre></div>


<p>These enhancements make it easier to write readable and maintainable code, especially when dealing with nested objects or complex conditions.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">🧩 With Expressions for Records</h3>



<p>With expressions allow for non-destructive mutation of records, enabling the creation of new record instances with modified properties. This feature promotes immutability and simplifies the process of updating record values.</p>



<h4 class="wp-block-heading">✅ Example:</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
var person = new Person(&quot;Alice&quot;, 30);
var updatedPerson = person with { Age = 31 };
</pre></div>


<p>This is particularly useful in functional programming paradigms and scenarios where data immutability is desired.​</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">🔐 Sealed ToString() Methods in Records</h3>



<p>C# 12 allows the <code>ToString()</code> method in records to be sealed, preventing further overrides in derived records. This ensures consistent string representations across different parts of an application.</p>



<h4 class="wp-block-heading">✅ Example:</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
public record Person(string Name, int Age)
{
    public sealed override string ToString() =&gt; $&quot;{Name}, {Age}&quot;;
}
</pre></div>


<p>Sealing the <code>ToString()</code> method can be beneficial when a standardized string output is required, such as in logging or serialization scenarios.​</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">🧵 Async Method Builders</h3>



<p>C# 12 introduces the ability to define custom async method builders, providing more control over asynchronous method execution. This feature is advanced and primarily useful for library authors or scenarios requiring customized async behavior.</p>



<h4 class="wp-block-heading">✅ Example:</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
public class CustomAsyncMethodBuilder
{
    public static CustomAsyncMethodBuilder Create() =&gt; new CustomAsyncMethodBuilder();
    public void SetResult() { /* Custom logic */ }
    // Other methods
}

public async CustomAsyncMethodBuilder MyAsyncMethod()
{
    await Task.Delay(1000);
}
</pre></div>


<p>Custom async method builders can be used to optimize performance or integrate with specific synchronization contexts.​</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">🛡️ Parameter Null Checking</h3>



<p>C# 12 introduces a concise syntax for parameter null checking, reducing boilerplate code and improving code readability. By appending <code>!!</code> to a parameter, the compiler automatically inserts null checks.</p>



<h4 class="wp-block-heading">✅ Example:</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
public void PrintName(string name!!)
{
    Console.WriteLine(name);
}
</pre></div>


<p>This feature helps in catching null reference exceptions early, enhancing the robustness of the code.​</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading">🧩 Extension Everything</h3>



<p>Building upon the concept of extension methods, C# 12 allows for the extension of properties, events, and even operators. This provides greater flexibility in augmenting existing types without modifying their source code.</p>



<h4 class="wp-block-heading">✅ Example:</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
public static class StringExtensions
{
    public static int WordCount(this string str) =&gt; str.Split(&#039; &#039;).Length;
}
</pre></div>


<p>This feature promotes cleaner code and better separation of concerns by enabling modular extensions.​</p>



<div class="wp-block-coblocks-faq" itemscope itemtype="https://schema.org/FAQPage">
<h4 class="wp-block-heading" id="h-"></h4>



<h3 class="wp-block-heading wp-block-coblocks-faq__title" id="h-faqs">FAQs</h3>



<details class="wp-block-coblocks-faq-item" itemprop="mainEntity" itemscope itemtype="https://schema.org/Question"><summary class="wp-block-coblocks-faq-item__question" itemprop="name"><div class="wp-block-coblocks-faq-item__question__content">Q: What are the primary benefits of C# 12?</div><svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="wp-block-coblocks-faq-item__question__icon" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M19.39 14.99l-1.41 1.41L12 10.43 6.02 16.4l-1.41-1.41L12 7.6l7.39 7.39z"></path></svg></summary><div class="wp-block-coblocks-faq-item__answer" itemprop="acceptedAnswer" itemscope itemtype="https://schema.org/Answer"><div itemprop="text">
<p>A: <a href="https://www.dotnetguide.com/csharp-program-structure-and-syntax/" target="_blank" rel="noreferrer noopener">C#</a> 12 introduces features that reduce boilerplate code, enhance readability, and provide more flexibility in method handling.</p>
</div></div></details>



<details class="wp-block-coblocks-faq-item" itemprop="mainEntity" itemscope itemtype="https://schema.org/Question"><summary class="wp-block-coblocks-faq-item__question" itemprop="name"><div class="wp-block-coblocks-faq-item__question__content">Q: How do primary constructors differ from traditional constructors?</div><svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="wp-block-coblocks-faq-item__question__icon" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M19.39 14.99l-1.41 1.41L12 10.43 6.02 16.4l-1.41-1.41L12 7.6l7.39 7.39z"></path></svg></summary><div class="wp-block-coblocks-faq-item__answer" itemprop="acceptedAnswer" itemscope itemtype="https://schema.org/Answer"><div itemprop="text">
<p>A: Primary constructors allow you to declare constructor parameters directly in the class or struct definition, simplifying initialization and reducing redundancy.</p>
</div></div></details>



<details class="wp-block-coblocks-faq-item" itemprop="mainEntity" itemscope itemtype="https://schema.org/Question"><summary class="wp-block-coblocks-faq-item__question" itemprop="name"><div class="wp-block-coblocks-faq-item__question__content">Q: Are there any compatibility concerns with older .NET versions?</div><svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="wp-block-coblocks-faq-item__question__icon" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M19.39 14.99l-1.41 1.41L12 10.43 6.02 16.4l-1.41-1.41L12 7.6l7.39 7.39z"></path></svg></summary><div class="wp-block-coblocks-faq-item__answer" itemprop="acceptedAnswer" itemscope itemtype="https://schema.org/Answer"><div itemprop="text">
<p>A: Yes, C# 12 features require <a href="https://dotnet.microsoft.com/en-us/learn/dotnet/what-is-dotnet" target="_blank" rel="noreferrer noopener nofollow">.NET </a>8 or later. Ensure your project targets a compatible framework version.</p>
</div></div></details>



<details class="wp-block-coblocks-faq-item" itemprop="mainEntity" itemscope itemtype="https://schema.org/Question"><summary class="wp-block-coblocks-faq-item__question" itemprop="name"><div class="wp-block-coblocks-faq-item__question__content"><strong>Q: Are primary constructors safe to use in production?</strong></div><svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="wp-block-coblocks-faq-item__question__icon" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M19.39 14.99l-1.41 1.41L12 10.43 6.02 16.4l-1.41-1.41L12 7.6l7.39 7.39z"></path></svg></summary><div class="wp-block-coblocks-faq-item__answer" itemprop="acceptedAnswer" itemscope itemtype="https://schema.org/Answer"><div itemprop="text">
<p>A: Yes — especially in services and models — but remember to define properties explicitly if needed.</p>
</div></div></details>



<details class="wp-block-coblocks-faq-item" itemprop="mainEntity" itemscope itemtype="https://schema.org/Question"><summary class="wp-block-coblocks-faq-item__question" itemprop="name"><div class="wp-block-coblocks-faq-item__question__content"><strong>Q: Can I use C# 12 with older .NET versions?</strong></div><svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="wp-block-coblocks-faq-item__question__icon" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M19.39 14.99l-1.41 1.41L12 10.43 6.02 16.4l-1.41-1.41L12 7.6l7.39 7.39z"></path></svg></summary><div class="wp-block-coblocks-faq-item__answer" itemprop="acceptedAnswer" itemscope itemtype="https://schema.org/Answer"><div itemprop="text">
<p>A: No, C# 12 features require .NET 8 or later.</p>
</div></div></details>



<details class="wp-block-coblocks-faq-item" itemprop="mainEntity" itemscope itemtype="https://schema.org/Question"><summary class="wp-block-coblocks-faq-item__question" itemprop="name"><div class="wp-block-coblocks-faq-item__question__content"><strong>Q: Are interceptors ready for production?</strong></div><svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="wp-block-coblocks-faq-item__question__icon" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M19.39 14.99l-1.41 1.41L12 10.43 6.02 16.4l-1.41-1.41L12 7.6l7.39 7.39z"></path></svg></summary><div class="wp-block-coblocks-faq-item__answer" itemprop="acceptedAnswer" itemscope itemtype="https://schema.org/Answer"><div itemprop="text">
<p>A: Use with caution. They&#8217;re still experimental and not recommended for mission-critical systems yet.</p>
</div></div></details>
</div>



<p>Check out our other interesting article: <a href="https://www.dotnetguide.com/blazor-vs-razor-pages/" target="_blank" rel="noreferrer noopener">Blazor vs Razor Pages</a></p>



<p></p>
<p>The post <a href="https://www.dotnetguide.com/c-12-features/">C# 12 Features You Should Be Using in 2025</a> appeared first on <a href="https://www.dotnetguide.com">Dot Net Guide</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dotnetguide.com/c-12-features/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Blazor vs Razor Pages in .NET 8: Choosing the Best Framework in 2025</title>
		<link>https://www.dotnetguide.com/blazor-vs-razor-pages/</link>
					<comments>https://www.dotnetguide.com/blazor-vs-razor-pages/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 11 Apr 2025 03:11:10 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://www.dotnetguide.com/?p=1584</guid>

					<description><![CDATA[<p>When Microsoft introduced Blazor in 2018, it revolutionized web development by enabling developers to build rich, interactive web UIs using C# instead of JavaScript. Concurrently, Razor Pages has been a reliable choice for server-side rendered applications, offering simplicity and efficiency. As we step into 2025 with the advancements in .NET 8, developers often face the ... </p>
<p class="read-more-container"><a title="Blazor vs Razor Pages in .NET 8: Choosing the Best Framework in 2025" class="read-more button" href="https://www.dotnetguide.com/blazor-vs-razor-pages/#more-1584">Read more<span class="screen-reader-text">Blazor vs Razor Pages in .NET 8: Choosing the Best Framework in 2025</span></a></p>
<p>The post <a href="https://www.dotnetguide.com/blazor-vs-razor-pages/">Blazor vs Razor Pages in .NET 8: Choosing the Best Framework in 2025</a> appeared first on <a href="https://www.dotnetguide.com">Dot Net Guide</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>When Microsoft introduced <strong>Blazor</strong> in 2018, it revolutionized web development by enabling developers to build rich, interactive web UIs using <strong>C# instead of JavaScript</strong>. Concurrently, <strong>Razor Pages</strong> has been a reliable choice for server-side rendered applications, offering simplicity and efficiency.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="626" height="324" src="https://www.dotnetguide.com/wp-content/uploads/2025/04/Blazor-Vs-Razor-Pages.jpg" alt="Blazor Vs Razor Pages" class="wp-image-1601" srcset="https://www.dotnetguide.com/wp-content/uploads/2025/04/Blazor-Vs-Razor-Pages.jpg 626w, https://www.dotnetguide.com/wp-content/uploads/2025/04/Blazor-Vs-Razor-Pages-300x155.jpg 300w" sizes="(max-width: 626px) 100vw, 626px" /></figure>



<p>As we step into <strong>2025</strong> with the advancements in <strong>.NET 8</strong>, developers often face the dilemma: <strong>Blazor vs Razor Pages</strong>—which framework aligns best with their project needs?​</p>



<p>In this comprehensive guide, we&#8217;ll explore:</p>



<ul class="wp-block-list">
<li><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f680.png" alt="🚀" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Real-world <strong>performance benchmarks</strong></li>



<li><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f501.png" alt="🔁" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Migration strategies</strong> from MVC to Blazor or Razor Pages</li>



<li><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2696.png" alt="⚖" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Pros and cons of each framework</li>



<li><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f4ca.png" alt="📊" class="wp-smiley" style="height: 1em; max-height: 1em;" /> A <strong>decision flowchart</strong></li>



<li><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f4c8.png" alt="📈" class="wp-smiley" style="height: 1em; max-height: 1em;" /> SEO-optimized content and keywords</li>



<li><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2753.png" alt="❓" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>FAQs</strong> for Google snippet ranking</li>
</ul>



<h2 class="wp-block-heading" id="h-what-is-blazor"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f9e0.png" alt="🧠" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>What is Blazor?</strong></h2>



<p>Blazor is a powerful web UI framework that enables developers to build interactive web applications using C# instead of JavaScript. Built on <a href="https://www.dotnetguide.com/introduction-to-dot-net-framework/">.NET</a>, Blazor promotes a full-stack C# development experience.</p>



<p>Blazor comes in two primary hosting models:</p>



<h3 class="wp-block-heading" id="h-blazor-webassembly-wasm"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/26a1.png" alt="⚡" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Blazor WebAssembly (WASM)</h3>



<p>Blazor WebAssembly allows C# code to run directly in the browser using WebAssembly, delivering SPA-like experiences with rich interactivity.</p>



<ul class="wp-block-list">
<li><strong>Client-side rendering</strong></li>



<li><strong>Works offline</strong></li>



<li><strong>Lighter server load</strong></li>



<li><strong>Great for PWAs and dashboards</strong></li>
</ul>



<p><strong>Example Use Case:</strong> SaaS dashboards, project management tools, design platforms (e.g., Figma clones)</p>



<h3 class="wp-block-heading" id="h-blazor-server"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f310.png" alt="🌐" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Blazor Server</strong></h3>



<p>Blazor Server executes C# code on the server and syncs UI changes over SignalR in real time. It&#8217;s ideal for scenarios that require server trust or frequent real-time UI updates.</p>



<ul class="wp-block-list">
<li><strong>Server-side logic with fast updates</strong></li>



<li><strong>Smaller initial load compared to WASM</strong></li>



<li><strong>Requires persistent connection (SignalR)</strong></li>



<li><strong>No offline support</strong></li>
</ul>



<p><strong>Example Use Case:</strong> Real-time inventory systems, live dashboards, internal admin panels</p>



<h3 class="wp-block-heading" id="h-blazor-component-example"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f527.png" alt="🔧" class="wp-smiley" style="height: 1em; max-height: 1em;" /><strong> Blazor Component Example</strong></h3>



<pre class="wp-block-code"><code>&lt;button @onclick="IncrementCount"&gt;Click me&lt;/button&gt;
&lt;p&gt;Current count: @currentCount&lt;/p&gt;

@code {
    private int currentCount = 0;
    private void IncrementCount() =&gt; currentCount++;
}</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading" id="h-what-are-razor-pages"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f4c4.png" alt="📄" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>What Are Razor Pages?</strong></h2>



<p><strong>Razor Pages</strong> is a <strong>page-focused web development model</strong> for ASP.NET Core that simplifies server-rendered web apps. It&#8217;s great for developers looking for <strong>fast load times</strong> and <strong>SEO optimization</strong>.</p>



<h3 class="wp-block-heading" id="h-key-features"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f511.png" alt="🔑" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Key Features</strong></h3>



<ul class="wp-block-list">
<li><strong>Fast page load times (~50KB HTML)</strong></li>



<li><strong>SEO-friendly architecture</strong></li>



<li><strong>Simple structure: .cshtml and .cshtml.cs files</strong></li>



<li><strong>Built-in support for form handling and model binding</strong></li>



<li><strong>Ideal For:</strong> Content-driven websites, CRUD applications, blogs, and marketing landing pages.</li>
</ul>



<p><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f4a1.png" alt="💡" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Razor Page Example</strong><br></p>



<pre class="wp-block-code"><code>public class IndexModel : PageModel
{
    public string Message { get; set; }
    public void OnGet() =&gt; Message = "Loaded in 12ms!";
}</code></pre>



<h2 class="wp-block-heading" id="h-blazor-vs-razor-pages-key-differences"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f50d.png" alt="🔍" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Blazor vs Razor Pages: Key Differences</strong></h2>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><th>Feature</th><th>Blazor WASM</th><th>Razor Pages</th></tr><tr><td>Initial Load</td><td>~2MB WASM download</td><td>~50KB HTML</td></tr><tr><td>SEO</td><td>Needs SSR</td><td>Fully SEO-optimized</td></tr><tr><td>Real-time UI</td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> via SignalR</td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> reload required</td></tr><tr><td>Offline Support</td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Supported</td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Not supported</td></tr><tr><td>Learning Curve</td><td>Moderate</td><td>Easy</td></tr><tr><td>Ideal Use Case</td><td>SPAs, Dashboards</td><td>Websites, Admin Panels</td></tr></tbody></table></figure>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading" id="h-when-to-use-blazor"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>When to Use Blazor</strong></h2>



<ul class="wp-block-list">
<li>You need interactive UI components</li>



<li>You want offline-first capabilities</li>



<li>You’re building a modern, SPA-style web application</li>



<li>You prefer full-stack development using C#</li>
</ul>



<p><strong>Best For:</strong></p>



<ul class="wp-block-list">
<li>Progressive Web Apps (PWAs)</li>



<li>Cross-platform line-of-business apps</li>



<li>Dashboard-driven tools</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading" id="h-when-to-use-razor-pages"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>When to Use Razor Pages</strong></h2>



<ul class="wp-block-list">
<li>Your application is content-heavy and SEO-focused</li>



<li>You need fast initial page load times</li>



<li>You&#8217;re building forms or CRUD-heavy apps</li>



<li>You want a simple migration from <a href="https://dotnet.microsoft.com/en-us/apps/aspnet/mvc">MVC</a></li>
</ul>



<p><strong>Best For:</strong></p>



<ul class="wp-block-list">
<li>Public-facing websites</li>



<li>Blogs and marketing pages</li>



<li>Government or healthcare portals</li>
</ul>



<h2 class="wp-block-heading" id="h-decision-flowchart"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f500.png" alt="🔀" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Decision Flowchart</strong></h2>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="683" src="https://www.dotnetguide.com/wp-content/uploads/2025/04/Blazor-vs-Razor-Decision-Flow-chart-1024x683.png" alt="Blazor vs Razor Pages Decision Flow chart" class="wp-image-1600" srcset="https://www.dotnetguide.com/wp-content/uploads/2025/04/Blazor-vs-Razor-Decision-Flow-chart-1024x683.png 1024w, https://www.dotnetguide.com/wp-content/uploads/2025/04/Blazor-vs-Razor-Decision-Flow-chart-300x200.png 300w, https://www.dotnetguide.com/wp-content/uploads/2025/04/Blazor-vs-Razor-Decision-Flow-chart-768x512.png 768w, https://www.dotnetguide.com/wp-content/uploads/2025/04/Blazor-vs-Razor-Decision-Flow-chart.png 1536w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading" id="h-net-8-performance-benchmarks"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f680.png" alt="🚀" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>.NET 8 Performance Benchmarks</strong></h2>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><td>Framework</td><td>Requests/sec</td><td>Avg. Latency</td></tr><tr><td>Razor Pages</td><td>1,200</td><td>18ms</td></tr><tr><td>Blazor WASM</td><td>300</td><td>1.4s</td></tr></tbody></table></figure>



<p><strong>Tested on:</strong> AWS t2.micro, ASP.NET Core 8.0</p>



<h3 class="wp-block-heading" id="h-key-insights">Key Insights:</h3>



<ul class="wp-block-list">
<li>Razor Pages offer blazing fast response times with minimal payloads, ideal for SEO.</li>



<li>Blazor WASM has a heavier load but shines in interactive applications post-load.</li>



<li>Blazor Server provides a sweet spot for responsive UIs in controlled environments.</li>
</ul>



<h2 class="wp-block-heading" id="h-migration-tips"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f501.png" alt="🔁" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Migration Tips</strong></h2>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p><strong>From MVC to Razor Pages:</strong></p>



<ul class="wp-block-list">
<li>Minimal learning curve for <strong>MVC </strong>developers</li>



<li>PageModel class mimics MVC controller logic</li>



<li>Retain Razor syntax with simplified routing</li>
</ul>



<p><strong>From MVC to Blazor:</strong></p>



<ul class="wp-block-list">
<li>Start with<strong> Blazor Server</strong> for a smoother transition</li>



<li>Leverage ComponentTagHelper to embed Blazor in Razor Pages</li>



<li>Plan for JS interop if needed</li>
</ul>



<h3 class="wp-block-heading" id="h-frequently-asked-questions-faq"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2753.png" alt="❓" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Frequently Asked Questions (FAQ)</strong></h3>



<div class="wp-block-coblocks-faq" itemscope itemtype="https://schema.org/FAQPage">
<details class="wp-block-coblocks-faq-item" itemprop="mainEntity" itemscope itemtype="https://schema.org/Question"><summary class="wp-block-coblocks-faq-item__question" itemprop="name"><div class="wp-block-coblocks-faq-item__question__content"><strong>Q: Is Blazor better than MVC?</strong></div><svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="wp-block-coblocks-faq-item__question__icon" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M19.39 14.99l-1.41 1.41L12 10.43 6.02 16.4l-1.41-1.41L12 7.6l7.39 7.39z"></path></svg></summary><div class="wp-block-coblocks-faq-item__answer" itemprop="acceptedAnswer" itemscope itemtype="https://schema.org/Answer"><div itemprop="text">
<p>A: For SPAs and rich UIs, <strong>Blazor</strong> is a better choice. But for SEO-heavy content or simple forms, <strong>MVC or Razor Pages</strong> still shine.</p>
</div></div></details>



<details class="wp-block-coblocks-faq-item" itemprop="mainEntity" itemscope itemtype="https://schema.org/Question"><summary class="wp-block-coblocks-faq-item__question" itemprop="name"><div class="wp-block-coblocks-faq-item__question__content"><strong>Q: Can I use both Blazor and Razor Pages together?</strong></div><svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="wp-block-coblocks-faq-item__question__icon" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M19.39 14.99l-1.41 1.41L12 10.43 6.02 16.4l-1.41-1.41L12 7.6l7.39 7.39z"></path></svg></summary><div class="wp-block-coblocks-faq-item__answer" itemprop="acceptedAnswer" itemscope itemtype="https://schema.org/Answer"><div itemprop="text">
<p>A: Yes! <strong>.NET 8</strong> supports <strong>hybrid rendering</strong>. Use Razor Pages for static content and embed Blazor for dynamic parts.</p>
</div></div></details>



<details class="wp-block-coblocks-faq-item" itemprop="mainEntity" itemscope itemtype="https://schema.org/Question"><summary class="wp-block-coblocks-faq-item__question" itemprop="name"><div class="wp-block-coblocks-faq-item__question__content"><strong>Q: Is Blazor good for SEO?</strong></div><svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="wp-block-coblocks-faq-item__question__icon" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M19.39 14.99l-1.41 1.41L12 10.43 6.02 16.4l-1.41-1.41L12 7.6l7.39 7.39z"></path></svg></summary><div class="wp-block-coblocks-faq-item__answer" itemprop="acceptedAnswer" itemscope itemtype="https://schema.org/Answer"><div itemprop="text">
<p>A: <strong>Blazor WebAssembly</strong> is not SEO-friendly by default. Use <strong>Blazor SSR</strong> or <strong>Razor Pages</strong> for search-critical content.</p>
</div></div></details>



<details class="wp-block-coblocks-faq-item" itemprop="mainEntity" itemscope itemtype="https://schema.org/Question"><summary class="wp-block-coblocks-faq-item__question" itemprop="name"><div class="wp-block-coblocks-faq-item__question__content"><strong>Q: How is Blazor different from Razor Pages?</strong></div><svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="wp-block-coblocks-faq-item__question__icon" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M19.39 14.99l-1.41 1.41L12 10.43 6.02 16.4l-1.41-1.41L12 7.6l7.39 7.39z"></path></svg></summary><div class="wp-block-coblocks-faq-item__answer" itemprop="acceptedAnswer" itemscope itemtype="https://schema.org/Answer"><div itemprop="text">
<p>A: Blazor is component-based and runs on the client or server. Razor Pages is a server-rendered page-centric model.</p>
</div></div></details>



<details class="wp-block-coblocks-faq-item" itemprop="mainEntity" itemscope itemtype="https://schema.org/Question"><summary class="wp-block-coblocks-faq-item__question" itemprop="name"><div class="wp-block-coblocks-faq-item__question__content"><strong>Q: Does Blazor support JavaScript libraries?</strong></div><svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="wp-block-coblocks-faq-item__question__icon" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M19.39 14.99l-1.41 1.41L12 10.43 6.02 16.4l-1.41-1.41L12 7.6l7.39 7.39z"></path></svg></summary><div class="wp-block-coblocks-faq-item__answer" itemprop="acceptedAnswer" itemscope itemtype="https://schema.org/Answer"><div itemprop="text">
<p>A: Yes, through <strong>JS Interop</strong>, but it can reduce the benefit of going full C#.</p>
</div></div></details>



<details class="wp-block-coblocks-faq-item" itemprop="mainEntity" itemscope itemtype="https://schema.org/Question"><summary class="wp-block-coblocks-faq-item__question" itemprop="name"><div class="wp-block-coblocks-faq-item__question__content"><strong>Q: Which .NET 8 framework has better performance?</strong></div><svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="wp-block-coblocks-faq-item__question__icon" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M19.39 14.99l-1.41 1.41L12 10.43 6.02 16.4l-1.41-1.41L12 7.6l7.39 7.39z"></path></svg></summary><div class="wp-block-coblocks-faq-item__answer" itemprop="acceptedAnswer" itemscope itemtype="https://schema.org/Answer"><div itemprop="text">
<p>A: <strong>Razor Pages</strong> has a faster initial load <a href="https://www.dotnetguide.com/c-datetime-format/" target="_blank" rel="noreferrer noopener">time </a>and lower latency. <strong>Blazor WASM</strong> offers interactivity at the cost of load size.</p>
</div></div></details>



<details class="wp-block-coblocks-faq-item" itemprop="mainEntity" itemscope itemtype="https://schema.org/Question"><summary class="wp-block-coblocks-faq-item__question" itemprop="name"><div class="wp-block-coblocks-faq-item__question__content"><strong>Q: Can Blazor be used for large-scale apps?</strong></div><svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="wp-block-coblocks-faq-item__question__icon" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M19.39 14.99l-1.41 1.41L12 10.43 6.02 16.4l-1.41-1.41L12 7.6l7.39 7.39z"></path></svg></summary><div class="wp-block-coblocks-faq-item__answer" itemprop="acceptedAnswer" itemscope itemtype="https://schema.org/Answer"><div itemprop="text">
<p>A: Yes, especially with <strong>Blazor Server</strong> or <strong>.NET 8’s Streaming Rendering</strong> features for scalability.</p>
</div></div></details>



<details class="wp-block-coblocks-faq-item" itemprop="mainEntity" itemscope itemtype="https://schema.org/Question"><summary class="wp-block-coblocks-faq-item__question" itemprop="name"><div class="wp-block-coblocks-faq-item__question__content"><strong>Q: Is Blazor faster than Razor Pages?</strong></div><svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="wp-block-coblocks-faq-item__question__icon" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M19.39 14.99l-1.41 1.41L12 10.43 6.02 16.4l-1.41-1.41L12 7.6l7.39 7.39z"></path></svg></summary><div class="wp-block-coblocks-faq-item__answer" itemprop="acceptedAnswer" itemscope itemtype="https://schema.org/Answer"><div itemprop="text">
<p>A: Not for initial load. Razor Pages loads faster (~50KB HTML), while Blazor WASM needs to download ~2 MB. However, <strong>Blazor offers faster client-side interactivity</strong> after the first load.</p>
</div></div></details>



<details class="wp-block-coblocks-faq-item" itemprop="mainEntity" itemscope itemtype="https://schema.org/Question"><summary class="wp-block-coblocks-faq-item__question" itemprop="name"><div class="wp-block-coblocks-faq-item__question__content"><strong>Q: Which is better for mobile web apps: Razor Pages or Blazor?</strong></div><svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="wp-block-coblocks-faq-item__question__icon" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M19.39 14.99l-1.41 1.41L12 10.43 6.02 16.4l-1.41-1.41L12 7.6l7.39 7.39z"></path></svg></summary><div class="wp-block-coblocks-faq-item__answer" itemprop="acceptedAnswer" itemscope itemtype="https://schema.org/Answer"><div itemprop="text">
<p>A: <strong>Blazor WebAssembly</strong> is great for <strong>progressive web apps (PWAs)</strong> and offline support. Razor Pages, while fast, depends on server round-trips and is not ideal for offline mobile use.</p>
</div></div></details>
</div>



<p></p>



<h2 class="wp-block-heading" id="h-final-verdict-blazor-vs-razor-pages"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f3c1.png" alt="🏁" class="wp-smiley" style="height: 1em; max-height: 1em;" /><strong> Final Verdict: Blazor vs Razor Pages</strong></h2>



<h3 class="wp-block-heading" id="h-choose-blazor-if"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Choose <strong>Blazor</strong> if:</h3>



<ul class="wp-block-list">
<li>You want a <strong>SPA-like experience</strong> with dynamic components</li>



<li>Prefer using <strong>C# over JavaScript</strong></li>



<li>Need <strong>offline support</strong> or rich interactivity</li>



<li>Want to reuse logic across client/server</li>
</ul>



<h3 class="wp-block-heading" id="h-choose-razor-pages-if"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Choose <strong>Razor Pages</strong> if:</h3>



<ul class="wp-block-list">
<li>You care about <strong>fast performance and SEO</strong></li>



<li>Your app is <strong>content-focused or form-heavy</strong></li>



<li>You need to deliver results fast with minimal complexity</li>



<li>You&#8217;re migrating from traditional ASP.NET MVC</li>
</ul>



<p><strong>Final Thoughts</strong></p>



<p>Blazor and Razor Pages are both powerful tools in the .NET 8 ecosystem. Instead of choosing one over the other, consider a<strong> hybrid model</strong> where <strong>Razor Pages handle SEO</strong> and content delivery, while <strong>Blazor enhances interactivity</strong>. With careful planning, you can leverage the strengths of both for a modern, high-performing web app</p>



<p></p>
<p>The post <a href="https://www.dotnetguide.com/blazor-vs-razor-pages/">Blazor vs Razor Pages in .NET 8: Choosing the Best Framework in 2025</a> appeared first on <a href="https://www.dotnetguide.com">Dot Net Guide</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dotnetguide.com/blazor-vs-razor-pages/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Visual Studio Code Vs Atom: The Ultimate Comparison</title>
		<link>https://www.dotnetguide.com/visual-studio-code-vs-atom/</link>
					<comments>https://www.dotnetguide.com/visual-studio-code-vs-atom/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 25 Mar 2025 06:09:34 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://www.dotnetguide.com/?p=1527</guid>

					<description><![CDATA[<p>In the fast-paced world of software development, choosing the right source code editor can make or break your productivity. Two of the most popular editors in the modern developer’s toolkit are&#160;Visual Studio Code (VS Code)&#160;and&#160;Atom. Both are free, open-source, and packed with features, but they cater to slightly different audiences and use cases. This comprehensive ... </p>
<p class="read-more-container"><a title="Visual Studio Code Vs Atom: The Ultimate Comparison" class="read-more button" href="https://www.dotnetguide.com/visual-studio-code-vs-atom/#more-1527">Read more<span class="screen-reader-text">Visual Studio Code Vs Atom: The Ultimate Comparison</span></a></p>
<p>The post <a href="https://www.dotnetguide.com/visual-studio-code-vs-atom/">Visual Studio Code Vs Atom: The Ultimate Comparison</a> appeared first on <a href="https://www.dotnetguide.com">Dot Net Guide</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In the fast-paced world of software development, choosing the right source code editor can make or break your productivity. Two of the most popular editors in the modern developer’s toolkit are&nbsp;<strong>Visual Studio Code (VS Code)</strong>&nbsp;and&nbsp;<strong>Atom</strong>. Both are free, open-source, and packed with features, but they cater to slightly different audiences and use cases. This comprehensive comparison of&nbsp;<strong>Visual Studio Code vs Atom</strong>&nbsp;will help you decide which editor is the best fit for your needs.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="975" height="504" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-2.png" alt="" class="wp-image-1528" srcset="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-2.png 975w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-2-300x155.png 300w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-2-768x397.png 768w" sizes="(max-width: 975px) 100vw, 975px" /></figure>



<p>Whether you’re searching for <strong>Atom vs VSCode</strong>, <strong>VSCode vs Atom</strong>, or <strong>Atom versus Visual Studio Code</strong>, this guide covers everything you need to know. We’ll dive into their features, performance, and customization options.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p><strong>What is a Source Code Editor?</strong></p>



<p>A source code editor is a specialized tool designed for writing and editing code. Unlike traditional text editors, these tools come equipped with features like&nbsp;<strong>syntax highlighting</strong>,&nbsp;<strong>code completion</strong>,&nbsp;<strong>debugging</strong>, and&nbsp;<strong>plugin support</strong>, making them indispensable for developers. While some editors are standalone applications, others are part of&nbsp;<strong>Integrated Development Environments (IDEs)</strong>&nbsp;that offer additional tools for building and deploying software.</p>



<p>In this comparison, we’ll focus on&nbsp;<strong>Visual Studio Code</strong>&nbsp;and&nbsp;<strong>Atom</strong>, two editors that straddle the line between lightweight text editors and full-fledged IDEs. Both are highly customizable, extensible, and widely used in modern web and cloud application development.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading" id="h-visual-studio-code-vs-atom-an-overview"><strong>Visual Studio Code vs Atom: An Overview</strong></h3>



<p>Before diving into the specifics, let’s briefly introduce both editors:</p>



<ul class="wp-block-list">
<li><strong>Visual Studio Code (VS Code):</strong>&nbsp;Developed by Microsoft, VS Code is a free, open-source editor known for its speed, versatility, and robust feature set. It supports a wide range of programming languages, including&nbsp;<strong>JavaScript</strong>,&nbsp;<strong>TypeScript</strong>, and&nbsp;<strong>Node.js</strong>, and is available for&nbsp;<strong>Windows</strong>,&nbsp;<strong>macOS</strong>, and&nbsp;<strong>Linux</strong>. For a deeper dive into VS Code’s capabilities,</li>



<li><strong>Atom:</strong>&nbsp;Created by GitHub, Atom is another free, open-source editor often referred to as the&nbsp;<strong>&#8220;hackable text editor for the 21st century.&#8221;</strong>&nbsp;It’s highly customizable, with a strong emphasis on community-driven plugins and themes. Like VS Code, it’s available for&nbsp;<strong>Windows</strong>,&nbsp;<strong>macOS</strong>, and&nbsp;<strong>Linux</strong>.</li>
</ul>



<p><strong>Now, let’s explore the history of the Atom editor</strong></p>



<p><strong>Who Owns Atom Editor? (The Surprising Truth Developers Should Know)</strong></p>



<p>If you&#8217;re wondering what happened to Atom, the once-beloved code editor, the ownership story reveals why it disappeared. Let me explain in simple terms:</p>



<p><strong>The Short Answer:</strong><br>Atom is technically owned by Microsoft through their GitHub acquisition, but it&#8217;s no longer actively developed.</p>



<p><strong>The Full Timeline:</strong></p>



<ol start="1" class="wp-block-list">
<li><strong>The GitHub Era (2011-2018)</strong>
<ul class="wp-block-list">
<li>Created by GitHub as an open-source alternative</li>



<li>Pioneered &#8220;hackable&#8221; editor concepts</li>



<li>Gained passionate following among web developers</li>
</ul>
</li>



<li><strong>The Microsoft Takeover (2018)</strong>
<ul class="wp-block-list">
<li>Microsoft acquired GitHub for $7.5B</li>



<li>Created awkward sibling rivalry with VS Code</li>



<li>Development slowed as resources shifted</li>
</ul>
</li>



<li><strong>The Sunset (2022-Present)</strong>
<ul class="wp-block-list">
<li>Officially discontinued December 2022</li>



<li>Still downloadable but unsupported</li>



<li>Most features absorbed into VS Code</li>
</ul>
</li>
</ol>



<p><strong>Why This Matters for Developers:</strong></p>



<ul class="wp-block-list">
<li>VS Code now dominates with 75%+ market share</li>



<li>Microsoft consolidated their editor strategy</li>



<li>Many Atom features live on in VS Code</li>
</ul>



<p></p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading" id="h-feature-comparison-vs-code-vs-atom"><strong>Feature Comparison: VS Code vs Atom</strong></h2>



<p>To help you decide which editor is right for you, let’s compare&nbsp;<strong>Visual Studio Code</strong>&nbsp;and&nbsp;<strong>Atom</strong>&nbsp;across several key categories:</p>



<p><strong>1. Setup and Installation</strong></p>



<p>Both editors are straightforward to install, but there are subtle differences:</p>



<ul class="wp-block-list">
<li><strong>VS Code:</strong>&nbsp;Offers a lightweight installer with more built-in features, reducing the need for additional plugins right out of the box.</li>



<li><strong>Atom:</strong>&nbsp;Has a larger installation size, which can impact performance, especially when multiple plugins are added.</li>
</ul>



<p>For a step-by-step guide on installing and setting up VS Code, Please follow below steps.</p>



<h2 class="wp-block-heading" id="h-visual-studio-code-installation-on-windows">Visual Studio Code Installation on Windows</h2>



<h4 class="wp-block-heading" id="h-nbsp-step-1-nbsp-download-the-exe-package-from-the-official-website-as-shown-below">&nbsp;<strong>Step 1:</strong>&nbsp;Download the .exe package from the official website as shown below.</h4>



<p>You can download the Visual Studio Code from their&nbsp;<a href="https://code.visualstudio.com/" target="_blank" rel="noreferrer noopener">Official Website.</a> Or search Visual Studio code on Google and click on first link</p>



<figure class="wp-block-image size-full"><img decoding="async" width="975" height="331" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-4.png" alt="VS Code vs atom" class="wp-image-1530" srcset="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-4.png 975w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-4-300x102.png 300w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-4-768x261.png 768w" sizes="(max-width: 975px) 100vw, 975px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="975" height="438" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-5.png" alt="VS Code vs atom : Visual  studio code installation" class="wp-image-1531" srcset="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-5.png 975w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-5-300x135.png 300w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-5-768x345.png 768w" sizes="(max-width: 975px) 100vw, 975px" /></figure>



<p><strong>Step 2:</strong>&nbsp;Now run the executable file. As you run, you will see the below window.</p>



<p><strong>Step 3:</strong>&nbsp;Select the option&nbsp;<strong>“I accept the agreement”</strong>&nbsp;and click on&nbsp;<strong>Next</strong>.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="913" height="507" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-6.png" alt="VS Code vs atom : Visual  studio code installation" class="wp-image-1532" srcset="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-6.png 913w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-6-300x167.png 300w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-6-768x426.png 768w" sizes="(max-width: 913px) 100vw, 913px" /></figure>



<p><strong>Step </strong><strong>4</strong><strong>:</strong>&nbsp;Select the other tasks that you would like to perform from the below window.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="915" height="456" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-7.png" alt="VS Code vs atom : Visual  studio code installation" class="wp-image-1533" srcset="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-7.png 915w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-7-300x150.png 300w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-7-768x383.png 768w" sizes="(max-width: 915px) 100vw, 915px" /></figure>



<p><strong>Step </strong><strong>5</strong><strong>:</strong>&nbsp;Click on&nbsp;<strong>Install</strong>&nbsp;from the following window.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="921" height="533" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-8.png" alt="VS Code vs atom : Visual  studio code installation" class="wp-image-1534" srcset="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-8.png 921w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-8-300x174.png 300w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-8-768x444.png 768w" sizes="(max-width: 921px) 100vw, 921px" /></figure>



<p><strong>Step </strong><strong>6</strong><strong>:</strong>&nbsp;Wait for the installation to be completed.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="901" height="475" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-9.png" alt="" class="wp-image-1535" srcset="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-9.png 901w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-9-300x158.png 300w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-9-768x405.png 768w" sizes="(max-width: 901px) 100vw, 901px" /></figure>



<p><strong>Step 8:</strong>&nbsp;As the installation gets completed, you will land on the below window. Click on <strong>Finish</strong> button.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="901" height="565" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-10.png" alt="VS Code vs atom : Visual  studio code installation" class="wp-image-1536" srcset="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-10.png 901w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-10-300x188.png 300w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-10-768x482.png 768w" sizes="(max-width: 901px) 100vw, 901px" /></figure>



<p><strong>Step 9:</strong>&nbsp;As you click on finish, the Visual Studio Code gets launched.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="775" height="458" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-11.png" alt="VS Code vs atom : Visual  studio code installation" class="wp-image-1537" srcset="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-11.png 775w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-11-300x177.png 300w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-11-768x454.png 768w" sizes="(max-width: 775px) 100vw, 775px" /></figure>



<h2 class="wp-block-heading" id="h-atom-installation-on-windows"><strong>Atom Installation On Windows</strong></h2>



<p><strong>Step #1:</strong>&nbsp;Download the .exe package from the&nbsp;<strong><a href="https://atom.io/" target="_blank" rel="noreferrer noopener">official website</a>&nbsp;</strong>as shown below.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="975" height="430" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-12.png" alt="ATOM installation" class="wp-image-1538" srcset="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-12.png 975w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-12-300x132.png 300w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-12-768x339.png 768w" sizes="(max-width: 975px) 100vw, 975px" /></figure>



<p><strong>Step #2:</strong>&nbsp;As you run the downloaded file, the below window will appear.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="573" height="583" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-13.png" alt="atom installation" class="wp-image-1539" srcset="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-13.png 573w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-13-295x300.png 295w" sizes="(max-width: 573px) 100vw, 573px" /></figure>



<p><strong>Step #3:</strong>&nbsp;As installation is complete, the Atom editor window is launched.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="975" height="699" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-14.png" alt="VS Code vs atom :atom installation" class="wp-image-1540" srcset="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-14.png 975w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-14-300x215.png 300w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-14-768x551.png 768w" sizes="(max-width: 975px) 100vw, 975px" /></figure>



<p><strong>2. Design and Customization</strong></p>



<ul class="wp-block-list">
<li>Both editors feature clean, modern interfaces with support for dark and light themes.</li>



<li><strong>VS Code:</strong>&nbsp;Provides a more polished and professional look, with a focus on usability.</li>



<li><strong>Atom:</strong>&nbsp;Excels in customization, allowing users to create and apply their own themes and UI tweaks with ease.</li>
</ul>



<p><strong>3. Performance</strong></p>



<ul class="wp-block-list">
<li><strong>VS Code:</strong>&nbsp;Known for its speed and efficiency, even with multiple extensions enabled. Its performance is often praised by developers.</li>



<li><strong>Atom:</strong>&nbsp;While functional, Atom can become sluggish when handling large files or running numerous plugins due to its extension-heavy architecture.</li>
</ul>



<figure class="wp-block-image size-full"><img decoding="async" width="975" height="405" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-15.png" alt="Performance comparison: VS Code vs Atom." class="wp-image-1541" srcset="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-15.png 975w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-15-300x125.png 300w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-15-768x319.png 768w" sizes="(max-width: 975px) 100vw, 975px" /></figure>



<p>           <em><strong>Performance comparison: VS Code vs Atom.</strong></em></p>



<p><strong>4. Configuration</strong></p>



<ul class="wp-block-list">
<li><strong>VS Code:</strong>&nbsp;Uses a simple JSON file for configuration, recently enhanced with a Graphical User Interface (GUI) for easier customization.</li>



<li><strong>Atom:</strong>&nbsp;Relies heavily on a GUI for configuration, offering a more intuitive but sometimes less flexible setup.</li>
</ul>



<p><strong>5. User Experience</strong></p>



<ul class="wp-block-list">
<li><strong>VS Code:</strong>&nbsp;Offers a seamless experience with a rich set of built-in features, making it ideal for both beginners and experienced developers.</li>



<li><strong>Atom:</strong>&nbsp;Provides a good user experience but requires more effort to configure and extend to match VS Code’s out-of-the-box capabilities.</li>
</ul>



<p><strong>6. Core Features</strong></p>



<ul class="wp-block-list">
<li><strong>VS Code:</strong>&nbsp;Comes with powerful built-in tools like&nbsp;<strong>IntelliSense (code completion)</strong>,&nbsp;<strong>debugging</strong>,&nbsp;<strong>Git integration</strong>, and&nbsp;<strong>Markdown preview</strong>.</li>



<li><strong>Atom:</strong>&nbsp;Relies more on plugins for core functionality, though it does include built-in Git integration.</li>
</ul>



<p>Let’s have a glimpse of the features that Visual Studio Code and Atom offer. This indeed will help to decide which editor to use as per the requirement.</p>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><td><strong>Sr. No.</strong></td><td><strong>Category</strong></td><td><strong>Visual Studio Code</strong></td><td><strong>Atom</strong></td></tr></thead><tbody><tr><td>1</td><td>Parent Company</td><td>Microsoft</td><td>GitHub (owned by Microsoft)</td></tr><tr><td>2</td><td>Extension/Plug-in</td><td>Yes (Rich marketplace)</td><td>Yes (Limited compared to VS Code)</td></tr><tr><td>3</td><td>License</td><td>MIT License</td><td>MIT License</td></tr><tr><td>4</td><td>Operating System</td><td>Linux, Windows, Mac OS X</td><td>Linux, Windows, Mac OS X</td></tr><tr><td>5</td><td>Syntax Highlighting</td><td>Yes</td><td>Yes</td></tr><tr><td>6</td><td>Multiple Selection</td><td>Yes</td><td>Yes</td></tr><tr><td>7</td><td>Block Selection</td><td>Yes</td><td>Yes</td></tr><tr><td>8</td><td>Smart Code Completion</td><td>IntelliSense (Advanced)</td><td>Basic Suggestions</td></tr><tr><td>9</td><td>Performance</td><td>5 Star (Optimized)</td><td>3-4 Star (Slower with large files)</td></tr><tr><td>10</td><td>Auto Complete Code</td><td>Yes (AI-powered in some cases)</td><td>Yes (Basic)</td></tr><tr><td>11</td><td>Multiple Projects</td><td>Yes</td><td>Yes</td></tr><tr><td>12</td><td>Version Control</td><td><strong>Native Git + Extensions (Bitbucket, etc.)</strong></td><td>GitHub/Git (Limited beyond that)</td></tr><tr><td>13</td><td>Price</td><td>Free</td><td>Free (Discontinued in 2022)</td></tr><tr><td>14</td><td>Debugging Tools</td><td><strong>Built-in</strong></td><td>Requires Plugins</td></tr><tr><td>15</td><td>Integrated Terminal</td><td><strong>Yes</strong></td><td>No (Needs Plugin)</td></tr><tr><td>16</td><td>Memory Usage</td><td>Lightweight</td><td>Can be resource-heavy</td></tr><tr><td>17</td><td>Active Development</td><td><strong>Yes (Frequent Updates)</strong></td><td>No (Discontinued)</td></tr></tbody></table></figure>



<p><strong>7. Plugins and Extensions</strong></p>



<ul class="wp-block-list">
<li><strong>VS Code:</strong>&nbsp;Has a vast library of extensions for adding language support, themes, and advanced features.</li>



<li><strong>Atom:</strong>&nbsp;Takes customization to the next level with a wide array of plugins, making it highly adaptable but potentially slower.</li>
</ul>



<p>Check out this&nbsp;<a href="https://www.dotnetguide.com/introduction-to-dot-net-framework/" target="_blank" rel="noreferrer noopener">Introduction To Dot Net Framework</a>&nbsp;to discover the concepts of the .NET framework.</p>



<p><strong>8. Community and Support</strong></p>



<ul class="wp-block-list">
<li>Both editors have large, active communities.</li>



<li><strong>VS Code:</strong>&nbsp;Backed by Microsoft, ensuring regular updates and strong support.</li>



<li><strong>Atom:</strong>&nbsp;Benefits from GitHub’s open-source community, fostering innovation and collaboration.</li>
</ul>



<p><strong>9. Source Control Integration</strong></p>



<ul class="wp-block-list">
<li><strong>Atom:</strong>&nbsp;As a GitHub product, it offers seamless Git integration, with visual indicators for uncommitted changes.</li>



<li><strong>VS Code:</strong>&nbsp;While it supports Git through extensions, it doesn’t quite match Atom’s native integration—though this may improve with Microsoft’s ownership of GitHub.</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p><strong>Additional Topics: Atom vs VSCode and Synonyms</strong></p>



<p>When discussing&nbsp;<strong>Atom vs VSCode</strong>, it’s important to consider synonyms and related terms like&nbsp;<strong>VSCode vs Atom</strong>,&nbsp;<strong>Atom versus Visual Studio Code</strong>, and&nbsp;<strong>Atom compared to VSCode</strong>. These terms are often used interchangeably, but they all refer to the same comparison between these two popular code editors.</p>



<p><strong>10. Ecosystem and Integration</strong></p>



<ul class="wp-block-list">
<li><strong>VS Code:</strong>&nbsp;Integrates seamlessly with Microsoft’s ecosystem, including Azure, GitHub, and other Microsoft services. It also supports a wide range of third-party tools and extensions.</li>



<li><strong>Atom:</strong>&nbsp;Being a GitHub product, it integrates naturally with GitHub repositories, making it a favorite among open-source developers.</li>
</ul>



<p><strong>11. Learning Curve</strong></p>



<ul class="wp-block-list">
<li><strong>VS Code:</strong>&nbsp;Easier for beginners due to its intuitive interface and extensive documentation.</li>



<li><strong>Atom:</strong>&nbsp;Slightly steeper learning curve due to its reliance on plugins and customization.</li>
</ul>



<p><strong>12. Updates and Maintenance</strong></p>



<ul class="wp-block-list">
<li><strong>VS Code:</strong>&nbsp;Receives frequent updates from Microsoft, ensuring it stays current with the latest development trends.</li>



<li><strong>Atom:</strong>&nbsp;Updates are less frequent, but the open-source community ensures it remains relevant.</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p><strong>Frequently Asked Questions</strong></p>



<ol start="1" class="wp-block-list">
<li><strong>Why is VS Code faster than Atom?</strong><br>VS Code has more built-in features, whereas Atom relies on plugins for similar functionality, which can slow it down.</li>



<li><strong>Is VS Code based on Atom?</strong><br>No, but both editors use the Electron framework. VS Code includes additional features like IntelliSense that set it apart.</li>



<li><strong>Is Atom owned by Microsoft?</strong><br>Atom is developed by GitHub, which is owned by Microsoft.</li>



<li><strong>What’s the difference between VS Code and Visual Studio?</strong><br>VS Code is a lightweight text editor, while Visual Studio is a full-fledged IDE with advanced tools for debugging, compiling, and more.</li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p><strong>Conclusion</strong></p>



<p>Both&nbsp;<strong>Visual Studio Code</strong>&nbsp;and&nbsp;<strong>Atom</strong>&nbsp;are excellent choices for developers, each with its own strengths and weaknesses. VS Code shines with its performance, built-in features, and polished user experience, making it a favorite for many. Atom, on the other hand, offers unparalleled customization and flexibility, appealing to those who enjoy tailoring their tools to their exact needs.</p>



<p>If you’re new to coding, either editor will serve you well. However, if performance and ease of use are your priorities, VS Code is the better choice. For those who value customization and don’t mind a bit of setup, Atom is a strong contender.</p>



<p>Ultimately, the best way to decide is to try both editors and see which one aligns with your workflow and preferences. Happy coding!</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>
<p>The post <a href="https://www.dotnetguide.com/visual-studio-code-vs-atom/">Visual Studio Code Vs Atom: The Ultimate Comparison</a> appeared first on <a href="https://www.dotnetguide.com">Dot Net Guide</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dotnetguide.com/visual-studio-code-vs-atom/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Gogoanime Alternatives (2025) | Best Legal Anime Sites</title>
		<link>https://www.dotnetguide.com/gogoanime-a-comprehensive-guide-alternatives/</link>
					<comments>https://www.dotnetguide.com/gogoanime-a-comprehensive-guide-alternatives/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 18 Mar 2025 04:03:46 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://www.dotnetguide.com/?p=1502</guid>

					<description><![CDATA[<p>Looking for safe, high-quality anime streaming sites? Here&#8217;s your ultimate guide to Gogoanime, its risks, and the top legal alternatives in 2025. Anime fans worldwide rely on platforms like&#160;Gogoanime&#160;to stream their favorite shows. However, with frequent shutdowns and legal concerns, many users search for reliable&#160;Gogoanime alternatives. In this guide, we’ll explore: Gogoanime has become a ... </p>
<p class="read-more-container"><a title="Gogoanime Alternatives (2025) &#124; Best Legal Anime Sites" class="read-more button" href="https://www.dotnetguide.com/gogoanime-a-comprehensive-guide-alternatives/#more-1502">Read more<span class="screen-reader-text">Gogoanime Alternatives (2025) &#124; Best Legal Anime Sites</span></a></p>
<p>The post <a href="https://www.dotnetguide.com/gogoanime-a-comprehensive-guide-alternatives/">Gogoanime Alternatives (2025) | Best Legal Anime Sites</a> appeared first on <a href="https://www.dotnetguide.com">Dot Net Guide</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p><strong>Looking for safe, high-quality anime streaming sites? Here&#8217;s your ultimate guide to Gogoanime, its risks, and the top legal alternatives in 2025.</strong></p>



<p>Anime fans worldwide rely on platforms like&nbsp;<strong>Gogoanime</strong>&nbsp;to stream their favorite shows. However, with frequent shutdowns and legal concerns, many users search for reliable&nbsp;<em>Gogoanime alternatives</em>. In this guide, we’ll explore:</p>



<ul class="wp-block-list">
<li>Safety tips to avoid malware and scams</li>



<li>What Gogoanime offers (and its risks)</li>



<li><strong>10+ best free anime sites</strong>&nbsp;(legal &amp; pirated)</li>



<li>Key features like&nbsp;<strong>dub/sub options, library size, and ad-free experiences</strong></li>
</ul>



<figure class="wp-block-image size-full"><img decoding="async" width="975" height="548" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/image.png" alt="Gogoanime" class="wp-image-1503" srcset="https://www.dotnetguide.com/wp-content/uploads/2025/03/image.png 975w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-300x169.png 300w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-768x432.png 768w" sizes="(max-width: 975px) 100vw, 975px" /></figure>



<p><strong>Gogoanime has become a household name among anime enthusiasts, offering a vast library of anime series, movies, and OVAs for free</strong>. With its user-friendly interface and regular updates, it’s no wonder that millions of fans flock to the site to watch their favorite shows. However, the platform’s legality and ethical implications have sparked debates within the anime community.</p>



<h3 class="wp-block-heading" id="h-what-is-gogoanime"><strong>What is Gogoanime?</strong></h3>



<p>Gogoanime is one of the most searched free anime streaming websites globally. It offers a vast library of anime shows, movies, and OVAs with subbed and dubbed content. With fast updates and zero registration, it&#8217;s a go-to choice for millions of fans.</p>



<p>However, <strong>Gogoanime operates illegally</strong>, hosting copyrighted anime without licenses. This puts users at risk of malware, legal trouble, and constant domain changes.</p>



<h4 class="wp-block-heading"><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Gogoanime Pros:</strong></h4>



<ul class="wp-block-list">
<li>10,000+ anime titles</li>



<li>Daily updates with latest episodes</li>



<li>No signup needed</li>



<li>Both dubbed and subbed content</li>
</ul>



<p><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Gogoanime Cons:</strong></p>



<ul class="wp-block-list">
<li>Unstable domains (frequent shutdowns)</li>



<li>Legal risks and lack of licenses</li>



<li>Aggressive pop-up ads and potential malware</li>



<li>Poor app experience</li>
</ul>



<p>A good internet connection is all you need to watch new and classic anime in high-definition on this platform. However, there is a massive caveat for Gogoanime. It isn’t exactly legitimate. Gogo Anime has no license or permission to stream the shows or movies it harbors in its library. Thankfully, there are legitimate alternatives to GOGO Anime where you can legally and safely stream Anime content</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="429" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-1-1024x429.png" alt="gogo anime home page" class="wp-image-1505" srcset="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-1-1024x429.png 1024w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-1-300x126.png 300w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-1-768x322.png 768w, https://www.dotnetguide.com/wp-content/uploads/2025/03/image-1.png 1094w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>&nbsp;<a href="https://ww6.gogoanime2.org/">Visit Gogoanime Website</a></p>



<p>In this article, I aim to highlight some of the best anime streaming services available online while also addressing the concerns surrounding platforms like GOGO Anime. But before we delve into the details, let’s start with a quick overview of what anime is all about.</p>



<p><strong>What is Anime</strong>?</p>



<p>For those new to the world of anime, it refers to animated content originating from Japan. To be classified as anime, the creative and production teams behind it must be primarily Japanese. Historically, anime gained its initial popularity during the 1960s and 1970s, laying the foundation for the global phenomenon it is today.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="625" height="325" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/anime1.png" alt="anime" class="wp-image-1507" srcset="https://www.dotnetguide.com/wp-content/uploads/2025/03/anime1.png 625w, https://www.dotnetguide.com/wp-content/uploads/2025/03/anime1-300x156.png 300w" sizes="(max-width: 625px) 100vw, 625px" /></figure>



<p>Anime’s unique appeal lies in its distinctive art style, rich storytelling, and exploration of complex themes. These elements set it apart from traditional Western cartoons, making it a captivating medium for audiences worldwide. My fascination with anime began in the late 90s and early 2000s, when it was still a niche genre in the West. However, thanks to advancements in digital technology and globalization, anime has since exploded in popularity.</p>



<p>Today, streaming services have made it easier than ever to access anime. But with its growing ubiquity comes a new challenge: finding legitimate sources to enjoy it. This is a significant issue for anime fans in the West. The limited availability of legal streaming options has driven many to platforms like GOGO Anime, which operate in a legal gray area. This explains why such sites have become so popular, despite their questionable legitimacy.</p>



<h3 class="wp-block-heading" id="h-why-gogoanime-changes-its-domains-frequently"><strong>Why Gogoanime Changes Its Domains Frequently</strong></h3>



<p>One of the most puzzling aspects of <strong>Gogoanime </strong>is its frequent domain changes. This is primarily due to the platform&#8217;s legal gray area. Since Gogoanime hosts anime content without proper licensing, it often faces takedown requests and legal pressure. To avoid being shut down permanently, the site frequently switches domains, making it harder for authorities to track and block it.</p>



<p> While this allows the site to stay operational, it also creates inconvenience for users, who must constantly search for the latest working domain.</p>



<h3 class="wp-block-heading" id="h-pros-of-using-gogo-anime"><strong>Pros of Using Gogo anime</strong></h3>



<p>Gogoanime’s biggest advantage is its free access to anime. Unlike subscription-based platforms, Gogoanime doesn’t charge users a dime. It also offers a wide variety of content, catering to fans of all genres. The platform’s convenience and lack of account requirements make it an attractive option for casual viewers.</p>



<h3 class="wp-block-heading" id="h-cons-of-using-gogoanime"><strong>Cons of Using Gogoanime</strong></h3>



<p>Despite its benefits, Gogoanime has its drawbacks. The platform’s unauthorized distribution of anime content harms creators and the industry. Users also face risks like pop-up ads, malware, and inconsistent video quality. Furthermore, the lack of official support means that broken links or missing episodes are common issues.</p>



<p><strong>Gogoanime on App Store</strong><strong></strong></p>



<p>Gogoanime offers both mobile and desktop applications, which function similarly to its website. The app provides access to a vast library of anime content, including subbed and dubbed versions of popular shows and movies. However, based on user reviews, the app appears to have significant issues. Many users have reported that it is buggy, unresponsive, and overall unreliable.</p>



<p>Despite the website&#8217;s popularity, the app has only around 50 downloads on the app store, indicating that it hasn’t gained much traction. While I haven’t personally used the app, the feedback from users suggests it falls short of expectations compared to the web version.</p>



<h3 class="wp-block-heading">Is Gogoanime Safe or Legal?</h3>



<p>No. Gogoanime is not safe or legal. Watching anime on unlicensed platforms may lead to:</p>



<ul class="wp-block-list">
<li>Malware and adware infections</li>



<li>Poor streaming experience</li>



<li>Legal consequences in certain regions</li>
</ul>



<p>To enjoy anime legally and support the industry, it&#8217;s best to use <strong>licensed anime streaming platforms</strong>.</p>



<p>As mentioned earlier, Gogoanime operates without the proper licenses to host the anime content in its library. Streaming or downloading from such platforms may infringe on intellectual property rights, potentially exposing users to legal risks in the future. While some frequent users praise Gogoanime for being ad-free and free of intrusive pop-ups, this doesn’t mean the platform is entirely safe. Websites like these can still expose your device to harmful viruses and malware.</p>



<p>Additionally, Gogoanime often suffers from long and unexpected downtimes, making it unreliable for a seamless viewing experience. Given these drawbacks, I strongly recommend opting for safe and legitimate platforms to watch anime. There are several excellent, licensed streaming services available that provide high-quality content while supporting the anime industry.</p>



<h3 class="wp-block-heading" id="h-top-15-best-legal-gogoanime-alternatives-2025"><strong>Top 15 Best Legal Gogoanime Alternatives (2025)</strong></h3>



<p>For those seeking legal and safe alternatives, platforms like Netflix, Crunchyroll, and Funimation offer extensive anime libraries. These services not only provide high-quality streaming but also support the anime industry by compensating creators and licensors.</p>



<h3 class="wp-block-heading" id="h-1-netflix"><strong>#1) Netflix</strong><strong></strong></h3>



<figure class="wp-block-image size-full"><img decoding="async" width="144" height="165" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/netflix.jpg" alt="netflix logo" class="wp-image-1509"/></figure>



<p><a href="https://www.softwaretestinghelp.com/wp-content/qa/uploads/2024/02/Netflix-1.png"></a></p>



<p>Netflix is a top choice for anime enthusiasts in the United States, thanks to its extensive and impressive anime library. The platform has gone the extra mile by remastering classic series, enhancing their picture quality for a better viewing experience. What’s more, Netflix simulcasts new episodes shortly after they air in Japan, ensuring fans stay up-to-date with their favorite shows. For those who crave premium quality, many of these titles are available in stunning 4K resolution.</p>



<p>One of Netflix’s standout features is its seamless streaming, with no buffering or downtime to interrupt your binge-watching sessions. It’s also a pioneer in the streaming world, being one of the few platforms investing in original anime productions. Beyond anime, Netflix offers a diverse collection of shows and movies from across the globe, making its subscription fee a worthwhile investment for entertainment lovers.</p>



<h3 class="wp-block-heading" id="h-netflix-plans-and-pricing"><strong>Netflix Plans and Pricing</strong>:</h3>



<ol class="wp-block-list">
<li><strong>Standard with Ads</strong>:<ol><li><strong>Price</strong>: $6.99/month</li></ol>
<ol class="wp-block-list">
<li><strong>Features</strong>:<ol><li>Access to most Netflix content with occasional ads.</li></ol><ol><li>Stream in Full HD (1080p).</li></ol>
<ol class="wp-block-list">
<li>Watch on 2 supported devices at a time.</li>
</ol>
</li>
</ol>
</li>



<li><strong>Standard (No Ads)</strong>:<ol><li><strong>Price</strong>: $15.49/month</li></ol>
<ol class="wp-block-list">
<li><strong>Features</strong>:<ol><li>Ad-free streaming.</li></ol><ol><li>Full HD (1080p) quality.</li></ol><ol><li>Watch on 2 devices simultaneously.</li></ol>
<ol class="wp-block-list">
<li>Option to download content on 2 devices.</li>
</ol>
</li>
</ol>
</li>



<li><strong>Premium</strong>:<ol><li><strong>Price</strong>: $22.99/month</li></ol>
<ol class="wp-block-list">
<li><strong>Features</strong>:<ol><li>Ad-free streaming.</li></ol><ol><li>Ultra HD (4K) and HDR quality.</li></ol><ol><li>Watch on 4 devices at the same time.</li></ol>
<ol class="wp-block-list">
<li>Option to download content on 6 devices.</li>
</ol>
</li>
</ol>
</li>
</ol>



<h3 class="wp-block-heading" id="h-2-crunchyroll"><strong>#2) Crunchyroll</strong><strong></strong></h3>



<figure class="wp-block-image size-full"><img decoding="async" width="285" height="88" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/chrunchyroll.jpg" alt="cruncyroll" class="wp-image-1510"/></figure>



<p><a href="https://www.softwaretestinghelp.com/wp-content/qa/uploads/2024/02/Crunchyroll.png"></a></p>



<p>Crunchyroll stands out as one of the most popular anime streaming platforms, not only in the USA but across the globe. With its recent acquisition of Funimation, the platform is set to expand its already massive library, making it an even more dominant force in the anime world.</p>



<p>What truly sets Crunchyroll apart is its unwavering focus on anime. It boasts one of the largest and most diverse collections of anime content worldwide, a feat no other platform can match. For just $7.99 per month, subscribers gain access to high-definition, ad-free streaming, with new episodes available shortly after they air in Japan. Additionally, Crunchyroll offers the convenience of offline viewing, making it a top choice for anime fans everywhere.</p>



<p><strong>Crunchyroll Plans and Pricing:</strong></p>



<ol start="1" class="wp-block-list">
<li><strong>Fan Plan</strong>:
<ul class="wp-block-list">
<li><strong>Price</strong>: $7.99/month</li>



<li><strong>Features</strong>:
<ul class="wp-block-list">
<li>Ad-free streaming.</li>



<li>Access to the entire Crunchyroll library, including simulcasts (episodes available shortly after they air in Japan).</li>



<li>High-definition (HD) video quality.</li>



<li>Offline viewing (download episodes on mobile devices).</li>
</ul>
</li>
</ul>
</li>



<li><strong>Mega Fan Plan</strong>:
<ul class="wp-block-list">
<li><strong>Price</strong>: $9.99/month</li>



<li><strong>Features</strong>:
<ul class="wp-block-list">
<li>All benefits of the Fan Plan.</li>



<li>Stream on up to 4 devices simultaneously.</li>



<li>Discounts on the Crunchyroll store.</li>



<li>Exclusive access to special events and promotions.</li>
</ul>
</li>
</ul>
</li>



<li><strong>Ultimate Fan Plan</strong>:
<ul class="wp-block-list">
<li><strong>Price</strong>: $14.99/month</li>



<li><strong>Features</strong>:
<ul class="wp-block-list">
<li>All benefits of the Mega Fan Plan.</li>



<li>Stream on up to 6 devices simultaneously.</li>



<li>Additional store discounts (e.g., 15% off).</li>



<li>Exclusive swag (e.g., annual gift).</li>
</ul>
</li>
</ul>
</li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p><strong>Free Trial:</strong></p>



<ul class="wp-block-list">
<li>Crunchyroll offers a&nbsp;<strong>14-day free trial</strong>&nbsp;for new subscribers to test out the premium features. This trial is available for all paid plans (Fan, Mega Fan, and Ultimate Fan).</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p><strong>Source Verification:</strong></p>



<p>You can verify this information directly on Crunchyroll’s official website:<br><a href="https://www.crunchyroll.com/welcome/premium" target="_blank" rel="noreferrer noopener">Crunchyroll Plans and Pricing</a> </p>



<h3 class="wp-block-heading" id="h-3-hulu"><strong>#3) Hulu</strong><strong></strong></h3>



<figure class="wp-block-image size-full"><img decoding="async" width="411" height="161" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/hulu.jpg" alt="hulu" class="wp-image-1511" srcset="https://www.dotnetguide.com/wp-content/uploads/2025/03/hulu.jpg 411w, https://www.dotnetguide.com/wp-content/uploads/2025/03/hulu-300x118.jpg 300w" sizes="(max-width: 411px) 100vw, 411px" /></figure>



<p><a href="https://www.softwaretestinghelp.com/wp-content/qa/uploads/2024/02/hulu-1.png"></a></p>



<p>Similar to Netflix, Hulu features a wide variety of anime content as part of its subscription offerings. The platform provides access to a mix of currently airing series and timeless classics. Although its anime library may not be as extensive as Crunchyroll’s or Netflix’s, Hulu still boasts a selection of critically acclaimed titles that make it a compelling option for anime fans.</p>



<h3 class="wp-block-heading" id="h-hulu-plans-and-pricing"><strong>Hulu Plans and Pricing </strong><strong>:</strong></h3>



<ol class="wp-block-list">
<li><strong>Hulu (With Ads)</strong>:<ol><li><strong>Price</strong>: $7.99/month</li></ol>
<ol class="wp-block-list">
<li><strong>Features</strong>:<ol><li>Access to Hulu&#8217;s entire streaming library, including anime, TV shows, movies, and Hulu Originals.</li></ol>
<ol class="wp-block-list">
<li>Includes ads during streaming.</li>
</ol>
</li>
</ol>
</li>



<li><strong>Hulu (No Ads)</strong>:<ol><li><strong>Price</strong>: $17.99/month</li></ol>
<ol class="wp-block-list">
<li><strong>Features</strong>:<ol><li>Ad-free streaming for most content (some shows may still have ads due to licensing restrictions).</li></ol>
<ol class="wp-block-list">
<li>Access to the same library as the ad-supported plan.</li>
</ol>
</li>
</ol>
</li>
</ol>



<p><a href="https://www.hulu.com/hub/anime" target="_blank" rel="noreferrer noopener">Hulu Website</a></p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading" id="h-4-amazon-prime"><strong>#4) Amazon Prime</strong><strong></strong></h3>



<figure class="wp-block-image size-full"><img decoding="async" width="160" height="145" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/prime-video.jpg" alt="prime video" class="wp-image-1512"/></figure>



<p><a href="https://www.softwaretestinghelp.com/wp-content/qa/uploads/2024/02/Amazon-Prime.png"></a></p>



<p>Amazon Prime stands as the second-largest streaming service in the US, trailing only behind Netflix. Naturally, it offers a selection of popular anime titles as part of its extensive library. The platform provides a diverse mix of licensed anime movies and TV shows, along with exclusive titles and simulcasts. Additionally, users have the option to rent or purchase digital anime content that isn’t included in the Prime membership.</p>



<ol class="wp-block-list">
<li><strong>Standalone Prime Video Plan</strong>:<ol><li><strong>Price</strong>: $8.99/month</li></ol>
<ol class="wp-block-list">
<li><strong>Features</strong>:<ol><li>Access to Prime Video&#8217;s library of movies, TV shows, and exclusive content (including anime).</li></ol>
<ol class="wp-block-list">
<li>Does not include other Amazon Prime benefits like free shipping, Prime Music, or Prime Reading.</li>
</ol>
</li>
</ol>
</li>



<li><strong>Amazon Prime Membership</strong>:
<ol class="wp-block-list">
<li><strong>Price</strong>:&nbsp;14.99/monthor14.99/<em>monthor</em>139/year<ul><li><strong>Features</strong>:<ul><li>Includes&nbsp;<strong>Prime Video</strong>&nbsp;access.Additional benefits like free two-day shipping, Prime Music, Prime Reading, and more.</li></ul></li></ul><a href="https://www.primevideo.com/genre/anime/" target="_blank" rel="noreferrer noopener">Amazon Prime Website</a></li>
</ol>
</li>
</ol>



<h3 class="wp-block-heading" id="h-5-retrocrush"><strong>#5) RetroCrush</strong></h3>



<figure class="wp-block-image size-full"><img decoding="async" width="279" height="131" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/retrocrush.jpg" alt="retro crush" class="wp-image-1513"/></figure>



<p><a href="https://www.softwaretestinghelp.com/wp-content/qa/uploads/2024/02/RetroCrush.png"></a></p>



<p>If you’re a fan of vintage anime, RetroCrush is a platform you’ll absolutely love. It boasts an extensive library of critically acclaimed anime from the&nbsp;<strong>1970s, 1980s, and 1990s</strong>, all carefully remastered by the RetroCrush team to enhance both picture and sound quality. The platform’s sleek and well-organized user interface makes navigation a breeze.</p>



<p>While many of these classic titles are behind a paywall, RetroCrush also offers a selection of anime that you can stream for free.</p>



<h3 class="wp-block-heading"><strong>RetroCrush Pricing</strong></h3>



<ol class="wp-block-list">
<li><strong>Free Plan</strong>:<ol><li><strong>Price</strong>: Free</li></ol>
<ol class="wp-block-list">
<li><strong>Features</strong>:<ol><li>Access to a selection of classic anime titles.</li></ol>
<ol class="wp-block-list">
<li>Ad-supported streaming.</li>
</ol>
</li>
</ol>
</li>



<li><strong>Premium Monthly Plan</strong>:<ol><li><strong>Price</strong>: $4.99/month</li></ol>
<ol class="wp-block-list">
<li><strong>Features</strong>:<ol><li>Ad-free streaming.</li></ol>
<ol class="wp-block-list">
<li>Access to the full library of remastered vintage anime.</li>
</ol>
</li>
</ol>
</li>



<li><strong>Premium Annual Plan</strong>:
<ol class="wp-block-list">
<li><strong>Price</strong>: $49.99/year</li>
</ol>
</li>
</ol>



<h3 class="wp-block-heading" id="h-6-funimation"><strong>#6) Funimation</strong></h3>



<figure class="wp-block-image size-full"><img decoding="async" width="227" height="152" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/funimation.jpg" alt="funimation" class="wp-image-1514"/></figure>



<p>Funimation was a leading anime streaming platform known for its high-quality English dubs and vast library of titles like&nbsp;<em>Dragon Ball Z</em>,&nbsp;<em>My Hero Academia</em>, and&nbsp;<em>Demon Slayer</em>. It offered simulcasts, exclusive content, and a user-friendly interface, making it a favorite among fans. In 2021, Funimation merged with Crunchyroll under Sony, and by 2022, its content was fully integrated into Crunchyroll. </p>



<p>While Funimation no longer operates as a standalone service, its legacy lives on through Crunchyroll, which now offers an even larger library of anime, including Funimation’s beloved dubs and exclusives. By subscribing to Crunchyroll, fans can enjoy ad-free, high-definition streaming while supporting the anime industry.</p>



<h3 class="wp-block-heading" id="h-7-hidive-nbsp"><strong>#7) HiDive</strong>&nbsp;</h3>



<figure class="wp-block-image size-full"><img decoding="async" width="166" height="61" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/hidive.jpg" alt="hidive" class="wp-image-1515"/></figure>



<p><strong>HiDive</strong>&nbsp;is a premium anime streaming platform that offers a diverse library of both classic and contemporary anime. Known for its curated selection, HiDive features exclusive titles, simulcasts, and a mix of subbed and dubbed content. With affordable subscription plans and a user-friendly interface, it’s a great choice for anime fans looking for high-quality, legal streaming options. Whether you&#8217;re into action-packed shonen, heartfelt slice-of-life, or niche genres, HiDive has something for everyone.</p>



<h4 class="wp-block-heading"><strong>Pricing Details</strong></h4>



<ul class="wp-block-list">
<li><strong>Monthly Plan</strong>: $4.99 per month.</li>



<li><strong>Annual Plan</strong>:&nbsp;47.99peryear(equivalenttoabout47.99<em>peryear</em>(<em>equivalenttoabout</em>3.99 per month, offering a 20% discount compared to the monthly plan). HiDive’s affordable pricing, combined with its curated selection, makes it a standout option for anime enthusiasts who want a legal and budget-friendly streaming service. </li>



<li><strong>Official Website</strong>:&nbsp;<a href="https://www.hidive.com/" target="_blank" rel="noreferrer noopener">HiDive</a></li>
</ul>



<h3 class="wp-block-heading" id="h-8-animelab"><strong>#8) AnimeLab</strong></h3>



<figure class="wp-block-image size-full"><img decoding="async" width="188" height="53" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/animelab.jpg" alt="animelab" class="wp-image-1517"/></figure>



<p>AnimeLab is a leading anime streaming service tailored for fans in Australia and New Zealand. It offers a vast library of anime, including popular series, movies, and simulcasts straight from Japan. With a mix of subbed and dubbed content, AnimeLab ensures that fans can enjoy their favorite shows in their preferred format. The platform is known for its user-friendly interface, high-quality streaming, and exclusive access to some of the biggest anime titles.</p>



<h4 class="wp-block-heading"><strong>Pricing Details</strong></h4>



<ul class="wp-block-list">
<li><strong>Free Plan</strong>: Access to a limited selection of anime with ads.</li>



<li><strong>Premium Plan</strong>:<ul><li><strong>Monthly Subscription</strong>: $7.95 AUD per month.</li></ul>
<ul class="wp-block-list">
<li><strong>Annual Subscription</strong>:&nbsp;79.95AUDperyear(equivalenttoabout79.95<em>AUDperyear</em>(<em>equivalenttoabout</em>6.66 AUD per month, offering a 16% discount compared to the monthly plan). AnimeLab’s premium plan unlocks ad-free streaming, early access to new episodes, and the entire anime library, making it a fantastic value for dedicated fans.</li>
</ul>
</li>
</ul>



<h3 class="wp-block-heading" id="h-9-aniwatch-formerly-zoro-to-nbsp-nbsp-best-free-ui"><strong>#9) Aniwatch (formerly Zoro.to)&nbsp;–&nbsp;Best Free UI</strong></h3>



<figure class="wp-block-image size-full"><img decoding="async" width="132" height="132" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-20.png" alt="aniwatch" class="wp-image-1569"/></figure>



<ul class="wp-block-list">
<li><strong>Library</strong>: 5,000+ titles (dub/sub)</li>



<li><strong>Features</strong>:
<ul class="wp-block-list">
<li><strong>Zero ads</strong>&nbsp;(rare for free sites)</li>



<li>Community reviews and ratings</li>
</ul>
</li>



<li><strong>Downside</strong>: Recently shut down; try&nbsp;<strong>AniWave</strong>&nbsp;(its successor)</li>
</ul>



<p><strong>Keyword Tip</strong>: A top&nbsp;<em>&#8220;best anime sites free&#8221;</em>&nbsp;option before shutdown.</p>



<h3 class="wp-block-heading" id="h-10-9anime-now-aniwave-nbsp-nbsp-best-for-dubs"><strong>#10) 9anime (Now AniWave)&nbsp;–&nbsp;Best for Dubs</strong></h3>



<figure class="wp-block-image size-full"><img decoding="async" width="171" height="75" src="https://www.dotnetguide.com/wp-content/uploads/2025/03/image-18.png" alt="9anime" class="wp-image-1566"/></figure>



<ul class="wp-block-list">
<li><strong>Library</strong>: 8,000+ anime (best-organized categories)</li>



<li><strong>Features</strong>:
<ul class="wp-block-list">
<li><strong>Filter by</strong>&nbsp;genre, year, popularity</li>



<li>Active community (request missing shows)</li>
</ul>
</li>
</ul>



<p><strong>Note</strong>: Use an ad blocker—pop-ups are common.<strong>9anime (Now AniWave)&nbsp;–&nbsp;Best for Dubs</strong></p>



<ul class="wp-block-list">
<li><strong>Library</strong>: 8,000+ anime (best-organized categories)</li>



<li><strong>Features</strong>:
<ul class="wp-block-list">
<li><strong>Filter by</strong>&nbsp;genre, year, popularity</li>



<li>Active community (request missing shows)</li>
</ul>
</li>
</ul>



<p><strong>Note</strong>: Use an ad blocker—pop-ups are common.</p>



<h3 class="wp-block-heading" id="h-11-pluto-tv"><strong>#11) Pluto TV</strong></h3>



<ul class="wp-block-list">
<li>100% free streaming with live anime channels</li>



<li>No registration required</li>



<li>Available in select regions</li>
</ul>



<h3 class="wp-block-heading" id="h-12-tubi-tv"><strong>#12)</strong> <strong>Tubi TV</strong></h3>



<ul class="wp-block-list">
<li>Free streaming with ads</li>



<li>Broad anime library including classics and new releases</li>



<li>Kid-safe content mode</li>
</ul>



<h3 class="wp-block-heading" id="h-13-vrv"><strong>#13)</strong> <strong>VRV</strong></h3>



<ul class="wp-block-list">
<li>Bundle of Crunchyroll, HIDIVE, and more</li>



<li>Best for anime and geek culture fans</li>
</ul>



<h3 class="wp-block-heading" id="h-14-bilibili-region-specific"><strong>#14)</strong> <strong>Bilibili (Region-Specific)</strong></h3>



<ul class="wp-block-list">
<li>Offers exclusive anime with interactive subtitles</li>



<li>Popular in Southeast Asia and China</li>
</ul>



<h3 class="wp-block-heading" id="h-15-youtube-official-channels"><strong>#15)</strong> <strong>YouTube (Official Channels)</strong></h3>



<ul class="wp-block-list">
<li>Channels like Muse Asia, Ani-One offer free legal anime</li>



<li>Available in many regions with minimal ads</li>
</ul>



<h2 class="wp-block-heading"><strong>Comparison of Top Anime Streaming Platforms</strong></h2>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><th>Platform</th><th>Free Option</th><th>Subbed</th><th>Dubbed</th><th>Simulcasts</th><th>Unique Features</th></tr><tr><td>Netflix</td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td>Originals, 4K, Global Reach</td></tr><tr><td>Crunchyroll</td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> (with ads)</td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td>Largest library, Fast Simulcasts</td></tr><tr><td>Funimation</td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td>Best for English Dubbed</td></tr><tr><td>HiDive</td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td>Niche titles, uncensored</td></tr><tr><td>Amazon Prime</td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> (included)</td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td>Prime exclusive anime</td></tr><tr><td>Hulu</td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> (with ads)</td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td>Mix of anime + Western shows</td></tr><tr><td>Tubi</td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td>Completely free, kid mode</td></tr><tr><td>RetroCrush</td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td>Nostalgic anime classics</td></tr><tr><td>Pluto TV</td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td>Live anime channels, no login needed</td></tr><tr><td>YouTube</td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td>Muse Asia &amp; Ani-One official content</td></tr><tr><td>VRV</td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/274c.png" alt="❌" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td>Bundled streaming, Crunchyroll + more</td></tr></tbody></table></figure>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading" id="h-how-to-choose-the-right-anime-site"><strong>How to Choose the Right Anime Site?</strong></h2>



<p>Ask these questions:</p>



<ol start="1" class="wp-block-list">
<li><strong>&#8220;Do I care about legality?&#8221;</strong>&nbsp;→ Use Crunchyroll/Tubi.</li>



<li><strong>&#8220;Do I need dubs?&#8221;</strong>&nbsp;→ Try AniWave or Funimation.</li>



<li><strong>&#8220;Is speed important?&#8221;</strong>&nbsp;→ Avoid ad-heavy sites like KissAnime.</li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading" id="h-safety-tips-for-free-anime-sites"><strong>Safety Tips for Free Anime Sites</strong></h3>



<p>To avoid malware when you&nbsp;<em>watch anime online</em>:</p>



<ul class="wp-block-list">
<li><strong>Use a VPN</strong>&nbsp;(e.g., NordVPN) to hide IP from ISPs.</li>



<li><strong>Install uBlock Origin</strong>&nbsp;to block malicious ads.</li>



<li><strong>Never download</strong>&nbsp;.exe files from streaming sites.</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading" id="h-legal-risks-of-using-gogoanime"><strong>Legal Risks of Using Gogoanime</strong></h3>



<ul class="wp-block-list">
<li><strong>DMCA notices</strong>: ISPs may throttle your connection.</li>



<li><strong>Malware infections</strong>: 32% of pirated sites host malicious scripts (<a href="https://www.digitalcitizen.life/piracy-security-risks/" target="_blank" rel="noreferrer noopener">source</a>).</li>
</ul>



<p><strong>Better Option</strong>: Use&nbsp;<strong>free trials</strong>&nbsp;of legal services (e.g., Crunchyroll’s 14-day trial).</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading" id="h-final-verdict-best-gogoanime-alternatives"><strong>Final Verdict: Best Gogoanime Alternatives</strong></h3>



<p>For most users, we recommend:</p>



<ul class="wp-block-list">
<li><strong><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f3c6.png" alt="🏆" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Best Legal Option</strong>: Crunchyroll</li>



<li><strong><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f48e.png" alt="💎" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Best Free Alternative</strong>: AniWave (if you accept risks)</li>



<li><strong><img src="https://s.w.org/images/core/emoji/16.0.1/72x72/1f4fa.png" alt="📺" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Best for Dubs</strong>: Funimation</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p><strong>FAQs About Gogoanime</strong></p>



<p><strong>Q: Is Gogoanime down?</strong><br>A: Its domains change often—check&nbsp;<em>Gogoanime. news</em>&nbsp;for updates.</p>



<p><strong>Q: What’s the safest free anime site?</strong><br>A:&nbsp;<strong>Tubi TV</strong>&nbsp;(legal) or&nbsp;<strong>Aniwatch</strong>&nbsp;(low ads).</p>



<h2 class="wp-block-heading" id="h-how-to-choose-the-right-anime-site-0"><strong>How to Choose the Right Anime Site?</strong></h2>



<p>Ask these questions:</p>



<ol start="1" class="wp-block-list">
<li><strong>&#8220;Do I care about legality?&#8221;</strong>&nbsp;→ Use Crunchyroll/Tubi.</li>



<li><strong>&#8220;Do I need dubs?&#8221;</strong>&nbsp;→ Try AniWave or Funimation.</li>



<li><strong>&#8220;Is speed important?&#8221;</strong>&nbsp;→ Avoid ad-heavy sites like KissAnime.</li>
</ol>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading" id="h-safety-tips-for-free-anime-sites-0"><strong>Safety Tips for Free Anime Sites</strong></h2>



<p>To avoid malware when you&nbsp;<em>watch anime online</em>:</p>



<ul class="wp-block-list">
<li><strong>Use a VPN</strong>&nbsp;(e.g., NordVPN) to hide IP from ISPs.</li>



<li><strong>Install uBlock Origin</strong>&nbsp;to block malicious ads.</li>



<li><strong>Never download</strong>&nbsp;.exe files from streaming sites.</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading" id="h-legal-risks-of-using-gogoanime-0"><strong>Legal Risks of Using Gogoanime</strong></h2>



<p></p>



<ul class="wp-block-list">
<li><strong>DMCA notices</strong>: ISPs may throttle your connection.</li>



<li><strong>Malware infections</strong>: 32% of pirated sites host malicious scripts (<a href="https://www.digitalcitizen.life/piracy-security-risks/" target="_blank" rel="noreferrer noopener">source</a>).</li>
</ul>



<p><strong>Better Option</strong>: Use&nbsp;<strong>free trials</strong>&nbsp;of legal services (e.g., Crunchyroll’s 14-day trial).</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p><strong>FAQs About Gogoanime</strong></p>



<div class="schema-faq wp-block-yoast-faq-block"><div class="schema-faq-section" id="faq-question-1744477365441"><strong class="schema-faq-question"><strong>Q: Is Gogoanime down?</strong> <strong>Latest working domains (2025)</strong></strong> <p class="schema-faq-answer">A: Its domains change often—check <em>Gogoanime. news</em> for updates.</p> </div> <div class="schema-faq-section" id="faq-question-1744493567459"><strong class="schema-faq-question">Q: Is Gogoanime legal?</strong> <p class="schema-faq-answer">No, Gogoanime operates without licensing agreements.</p> </div> <div class="schema-faq-section" id="faq-question-1744493607110"><strong class="schema-faq-question"><strong>Q: <strong>What is the safest anime streaming site?</strong></strong></strong> <p class="schema-faq-answer">A: Crunchyroll and Netflix are among the safest and most reliable platforms.</p> </div> <div class="schema-faq-section" id="faq-question-1744493778539"><strong class="schema-faq-question"><strong>Q: Is Gogoanime still working in 2025?</strong></strong> <p class="schema-faq-answer">A: Yes, but it keeps changing domains due to legal issues.</p> </div> <div class="schema-faq-section" id="faq-question-1744493944574"><strong class="schema-faq-question">Q: <strong>Can I watch anime for free legally?</strong></strong> <p class="schema-faq-answer">A: Yes, through platforms like Tubi, YouTube (Muse Asia), RetroCrush, and Crunchyroll&#8217;s free tier.</p> </div> <div class="schema-faq-section" id="faq-question-1744494141048"><strong class="schema-faq-question">Q: <strong>Why is Gogoanime not on Google search results?</strong></strong> <p class="schema-faq-answer">A: Due to DMCA takedowns and low SEO optimization. Also, search engines may de-prioritize illegal sites.</p> </div> </div>



<h2 class="wp-block-heading" id="h-how-to-access-gogoanime-safely-in-2025-3-steps">How to Access Gogoanime Safely in 2025 (3 Steps)</h2>



<ol class="wp-block-list">
<li><strong>Install a VPN</strong> (NordVPN or Surfshark recommended)</li>



<li><strong>Enable ad-blocking</strong> (uBlock Origin works best)</li>



<li><strong>Use mirror sites</strong> (Updated monthly list <a href="#">here</a>)</li>
</ol>



<p><strong>Conclusion</strong><strong></strong></p>



<p>Anime has seen an incredible rise in popularity across the West, fueled by the wide array of online streaming services. While it might be tempting to use platforms like Gogoanime, it’s important to consider the ethical implications. As anime fans, we have a responsibility to support the talented artists and creators behind these amazing shows and movies by choosing legitimate streaming sources.</p>



<p>Fortunately, there are far better ways to enjoy anime online. Platforms like Netflix and Crunchyroll offer high-quality streaming with crisp picture quality and accurate subtitles, ensuring a premium viewing experience. The platforms I’ve mentioned above are excellent alternatives to Gogoanime, providing access to both classic and contemporary anime that will delight any fan.</p>



<p>I encourage you to give these services a try. As a lifelong anime enthusiast, I’ve had nothing but positive experiences with these platforms, and I’m confident you’ll enjoy them just as much.</p>



<p><strong>Ready to Stream?</strong></p>



<p>Now that you know the&nbsp;<em>best Gogoanime alternatives</em>, bookmark this page for future updates.&nbsp;<strong>Share your favorite anime site in the comments!</strong></p>
<p>The post <a href="https://www.dotnetguide.com/gogoanime-a-comprehensive-guide-alternatives/">Gogoanime Alternatives (2025) | Best Legal Anime Sites</a> appeared first on <a href="https://www.dotnetguide.com">Dot Net Guide</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dotnetguide.com/gogoanime-a-comprehensive-guide-alternatives/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>UIPath Tutorial</title>
		<link>https://www.dotnetguide.com/uipath-tutorials/</link>
					<comments>https://www.dotnetguide.com/uipath-tutorials/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 18 Jun 2024 14:53:11 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://www.dotnetguide.com/?p=1026</guid>

					<description><![CDATA[<p>In our previous article of UIPath Tutorial, we discussed UIPath components, its features, and how we can install UIPath. Now in this UIPath tutorial, we will see the below topics. Tutorial 1: My First Sequence workflow Project &#8211; Display welcome message. Tutorial 2: Accept Input from a user. Tutorial 3: Use If condition and variables ... </p>
<p class="read-more-container"><a title="UIPath Tutorial" class="read-more button" href="https://www.dotnetguide.com/uipath-tutorials/#more-1026">Read more<span class="screen-reader-text">UIPath Tutorial</span></a></p>
<p>The post <a href="https://www.dotnetguide.com/uipath-tutorials/">UIPath Tutorial</a> appeared first on <a href="https://www.dotnetguide.com">Dot Net Guide</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In our previous <a href="https://www.dotnetguide.com/uipath-introduction/">article </a>of UIPath Tutorial, we discussed UIPath components, its features, and how we can install <a href="https://www.uipath.com/" target="_blank" rel="noreferrer noopener">UIPath</a>.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="624" height="324" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Tutorials.png" alt="UIPath Tutorials" class="wp-image-1025" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Tutorials.png 624w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Tutorials-300x156.png 300w" sizes="(max-width: 624px) 100vw, 624px" /></figure>



<p><strong>Now in this UIPath tutorial,</strong> we will see the <strong>below topics.</strong></p>



<p><strong>Tutorial 1: My First Sequence workflow Project &#8211; Display welcome message.</strong></p>



<p><strong>Tutorial 2: Accept Input from a user.</strong></p>



<p><strong>Tutorial 3: Use If condition and variables in the process.</strong></p>



<p><strong>Tutorial 4: Variables introduction (String) &amp; Use of Substring function.</strong></p>



<p><strong>Tutorial 5: Variables introduction (Integer)</strong></p>



<p><strong>Tutorial 6: Variables introduction (Boolean)</strong></p>



<p><strong>Tutorial 7: Introduction to flowchart workflow</strong></p>



<p><strong>Tutorial 8: Introduction to State Machine</strong></p>



<p><strong><strong>UiPath </strong>Tutorial 1:</strong></p>



<p><strong>Display “Hi welcome to my first Project”</strong></p>



<p><strong>Step 1:</strong> Create a new blank process</p>



<p>&nbsp;&nbsp;&nbsp;&nbsp; Add Process Name and Description.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="551" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-1-1024x551.png" alt="UIPath Tutorial" class="wp-image-971" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-1-1024x551.png 1024w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-1-300x161.png 300w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-1-768x413.png 768w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-1.png 1043w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p><strong>Step 2:</strong> On Design Tab -&gt;In Main.xaml: Add workflow type</p>



<ul class="wp-block-list">
<li>Sequence Chart-Used for the action which need to perform one after other.</li>



<li>Flow chart –Used to create complex business process as it allows us to do multiple branching of logical operators.</li>



<li>State machine</li>



<li>Global handler</li>
</ul>



<p><strong>Step 3:</strong> On Activity: add message box, click, read excel , send email etc.</p>



<p>Select Sequence -&gt; Select Message Box-&gt; add message “Hi welcome to my first project”</p>



<p><strong>Step 4:</strong> Debug-&gt; Run File: see the result.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="601" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-2-1024x601.png" alt="UIPath Tutorial" class="wp-image-972" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-2-1024x601.png 1024w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-2-300x176.png 300w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-2-768x451.png 768w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-2.png 1027w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="1022" height="599" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-3.png" alt="UIPath Tutorial" class="wp-image-973" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-3.png 1022w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-3-300x176.png 300w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-3-768x450.png 768w" sizes="(max-width: 1022px) 100vw, 1022px" /></figure>



<p><strong>UiPath Tutorial 2:</strong></p>



<p><strong>Display “Hi Noah Welcome to my first Project”</strong></p>



<ol class="wp-block-list">
<li>Continue with the first tutorial: add activity –Input Dialog</li>
</ol>



<p>-Add Input Label and Dialog Title.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="684" height="517" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-4.png" alt="UiPath Tutorial" class="wp-image-974" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-4.png 684w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-4-300x227.png 300w" sizes="(max-width: 684px) 100vw, 684px" /></figure>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="441" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-5-1024x441.png" alt="UiPath Tutorial" class="wp-image-975" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-5-1024x441.png 1024w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-5-300x129.png 300w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-5-768x330.png 768w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-5.png 1090w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<ul class="wp-block-list">
<li>Create <strong>Variable ‘</strong>Name’ and <strong>Variable Type</strong> as String.</li>



<li>Use that <strong>Variable</strong> in Message Box, as below</li>
</ul>



<p>&nbsp;&nbsp; &#8220;Hi, &#8220;+ Name +&#8221; welcome to my first project&#8221;</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1021" height="504" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-6.png" alt="UiPath Tutorial" class="wp-image-976" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-6.png 1021w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-6-300x148.png 300w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-6-768x379.png 768w" sizes="(max-width: 1021px) 100vw, 1021px" /></figure>



<ul class="wp-block-list">
<li>Input Dialog -&gt;Propertise -&gt;Output-&gt;add variable ‘Name’</li>
</ul>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="424" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-7-1024x424.png" alt="UiPath Tutorial" class="wp-image-977" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-7-1024x424.png 1024w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-7-300x124.png 300w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-7-768x318.png 768w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-7.png 1096w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<ul class="wp-block-list">
<li>Debug-&gt;Run File</li>
</ul>



<figure class="wp-block-image size-full"><img decoding="async" width="815" height="491" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-8.png" alt="" class="wp-image-978" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-8.png 815w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-8-300x181.png 300w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-8-768x463.png 768w" sizes="(max-width: 815px) 100vw, 815px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="795" height="503" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-9.png" alt="" class="wp-image-979" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-9.png 795w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-9-300x190.png 300w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-9-768x486.png 768w" sizes="(max-width: 795px) 100vw, 795px" /></figure>



<p><strong>UiPath Tutorial 3:</strong></p>



<p>Variable-Year (e.g. 2021,2022 etc.)</p>



<p>Condition: Check if the year is Leap year or not</p>



<p>If the Year is leap year (Condition is True)-Display Message-“The year is leap year”.</p>



<p>If the Year is not leap year (Condition is False)-Display Message-“The year is leap year”.</p>



<p><strong>Steps 1:</strong></p>



<p>Create New Blank Process.</p>



<p>On Design tab: Click On Main.xaml .</p>



<p>On Activity /tab: Select Sequence Workflow.</p>



<p><strong>Steps 2:</strong></p>



<p>Create <strong>Variable</strong> ‘Year’ select <strong>Variable Type</strong> and <strong>Default</strong> value.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="721" height="445" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-10.png" alt="" class="wp-image-980" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-10.png 721w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-10-300x185.png 300w" sizes="(max-width: 721px) 100vw, 721px" /></figure>



<p><strong>Step 3: Add Input Dialog box</strong> -&gt;add Dialog Title as “Enter the year“and &nbsp;Input Label as “Year Value”.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="748" height="456" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-11.png" alt="" class="wp-image-981" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-11.png 748w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-11-300x183.png 300w" sizes="(max-width: 748px) 100vw, 748px" /></figure>



<p><strong>Add If Activity :</strong></p>



<figure class="wp-block-image size-full"><img decoding="async" width="719" height="487" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-12.png" alt="" class="wp-image-982" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-12.png 719w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-12-300x203.png 300w" sizes="(max-width: 719px) 100vw, 719px" /></figure>



<p><strong>Step 4: </strong>Add If Condition for leap year</p>



<p>Year Mod 4=0 &nbsp;</p>



<p><strong>Step 5:</strong> Add message box activity for then and else condition. Add Text as below</p>



<figure class="wp-block-image size-full"><img decoding="async" width="765" height="501" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-13.png" alt="" class="wp-image-983" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-13.png 765w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-13-300x196.png 300w" sizes="(max-width: 765px) 100vw, 765px" /></figure>



<p><strong>Step 6:Debug File-&gt;</strong>Run File</p>



<p><strong>Enter Year Value as </strong>2020 (Leap Year)</p>



<figure class="wp-block-image size-full"><img decoding="async" width="773" height="459" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-14.png" alt="" class="wp-image-984" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-14.png 773w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-14-300x178.png 300w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-14-768x456.png 768w" sizes="(max-width: 773px) 100vw, 773px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="775" height="474" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-15.png" alt="" class="wp-image-985" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-15.png 775w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-15-300x183.png 300w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-15-768x470.png 768w" sizes="(max-width: 775px) 100vw, 775px" /></figure>



<p>&nbsp;<strong>Step 7 :Debug File-&gt;</strong>Run File</p>



<p><strong>Enter Year Value as </strong>2021(Not Leap Year)</p>



<figure class="wp-block-image size-full"><img decoding="async" width="754" height="453" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-16.png" alt="" class="wp-image-986" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-16.png 754w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-16-300x180.png 300w" sizes="(max-width: 754px) 100vw, 754px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="754" height="477" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-17.png" alt="" class="wp-image-987" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-17.png 754w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-17-300x190.png 300w" sizes="(max-width: 754px) 100vw, 754px" /></figure>



<p><strong>UiPath Tutorial 4: Text/String Variable- Substring variable project</strong></p>



<ul class="wp-block-list">
<li>Take User Name as User Input –Input Dialog</li>



<li>Display the first three letters of the user name in Message Box</li>



<li>Display User name in message box – Message Box</li>



<li>“The user name is&nbsp; “ + Username</li>
</ul>



<p><strong>Steps</strong> <strong>to follow:</strong></p>



<p>-Create New Processes-&gt;On Design tab-&gt;On Main.xaml-&gt;Add Sequence workflow-&gt;add Activity Input Dialog box</p>



<p>-Enter Dialog title and Input Label</p>



<p>-Create two String Variables- UserName and NewName for substring</p>



<p>-Add <strong>Assign activity</strong> -for display the three letters of the user name</p>



<p>Index-0 and length=3 assign the Index and length value&nbsp; in Substring</p>



<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NewName = Username.substring(0,3)</p>



<p>-Add Message Box Activity</p>



<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;The First three letters of Usename is &#8221; +NewName</p>



<p>-Add Message Box Activity</p>



<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;The Username is &#8221;&nbsp; + UserName</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1007" height="578" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-18.png" alt="" class="wp-image-988" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-18.png 1007w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-18-300x172.png 300w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-18-768x441.png 768w" sizes="(max-width: 1007px) 100vw, 1007px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="756" height="529" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-19.png" alt="" class="wp-image-989" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-19.png 756w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-19-300x210.png 300w" sizes="(max-width: 756px) 100vw, 756px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="746" height="524" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-20.png" alt="" class="wp-image-990" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-20.png 746w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-20-300x211.png 300w" sizes="(max-width: 746px) 100vw, 746px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="752" height="536" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-21.png" alt="" class="wp-image-991" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-21.png 752w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-21-300x214.png 300w" sizes="(max-width: 752px) 100vw, 752px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="749" height="536" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-22.png" alt="" class="wp-image-992" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-22.png 749w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-22-300x215.png 300w" sizes="(max-width: 749px) 100vw, 749px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="756" height="532" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-23.png" alt="" class="wp-image-993" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-23.png 756w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-23-300x211.png 300w" sizes="(max-width: 756px) 100vw, 756px" /></figure>



<p><strong>UiPath Tutorial 5: Number Variable/Integer Variable/Int32 Variable –Used to store Numeric Information</strong></p>



<p><strong>Display User –John and display total marks</strong></p>



<p>-Create 3 Variable for Subject like MarksInMath, MarksInEng, MarksInSS and TotalMarks</p>



<p>-Create 1 variable for Student Name like StudName</p>



<p>-Take User input for marks obtained in Math and assign the value to Variable –MarksInMath</p>



<p>-Take User input for marks obtained in English and assign the value to Variable – MarksInEng</p>



<p>-Take User input for marks obtained in Social Science and assign the value to Variable – MarksInSS</p>



<p>-Add Total Marks and Assign to New Variable to variable -TotalMarks</p>



<p>TotalMarks= MarksInMath+MarksInEng+MarksInSS</p>



<p>-Display Total Marks in Message Box.</p>



<p>StudName + &#8221; total marks is = &#8221;&nbsp; + TotalMarks.ToString</p>



<p><strong>Note</strong>: Add Variable as Output Result for each Input dialog box Properties</p>



<figure class="wp-block-image size-full"><img decoding="async" width="735" height="510" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-24.png" alt="" class="wp-image-994" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-24.png 735w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-24-300x208.png 300w" sizes="(max-width: 735px) 100vw, 735px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="733" height="524" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-25.png" alt="" class="wp-image-995" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-25.png 733w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-25-300x214.png 300w" sizes="(max-width: 733px) 100vw, 733px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="711" height="495" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-26.png" alt="" class="wp-image-996" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-26.png 711w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-26-300x209.png 300w" sizes="(max-width: 711px) 100vw, 711px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="754" height="421" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-27.png" alt="" class="wp-image-997" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-27.png 754w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-27-300x168.png 300w" sizes="(max-width: 754px) 100vw, 754px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="737" height="472" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-28.png" alt="" class="wp-image-998" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-28.png 737w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-28-300x192.png 300w" sizes="(max-width: 737px) 100vw, 737px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="726" height="448" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-29.png" alt="" class="wp-image-999" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-29.png 726w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-29-300x185.png 300w" sizes="(max-width: 726px) 100vw, 726px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="722" height="392" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-30.png" alt="" class="wp-image-1000" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-30.png 722w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-30-300x163.png 300w" sizes="(max-width: 722px) 100vw, 722px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="763" height="428" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-31.png" alt="" class="wp-image-1001" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-31.png 763w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-31-300x168.png 300w" sizes="(max-width: 763px) 100vw, 763px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="701" height="401" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-32.png" alt="" class="wp-image-1002" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-32.png 701w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-32-300x172.png 300w" sizes="(max-width: 701px) 100vw, 701px" /></figure>



<p><strong>UiPath Tutorial 6: Boolean Variable – True/False</strong></p>



<p><strong>Variable</strong>-Year (e.g. 2021, 2022 etc.) , BooleanVar – Boolean Variable &nbsp;</p>



<p><strong>Condition</strong>: Check if the year is Leap year or not</p>



<p>If the Year is leap year (Condition is <strong>True</strong>)-Display Message-“The year is leap year”.</p>



<p>If the Year is not leap year (Condition is <strong>False</strong>)-Display Message-“The year is leap year”.</p>



<p><strong>Steps 1:</strong></p>



<p>Create New Blank Process.</p>



<p>On Design tab: Click On Main.xaml .</p>



<p>On Activity /tab: Select Sequence Workflow.</p>



<p><strong>Steps 2:</strong></p>



<p>Create <strong>Variable</strong> ‘Year’ select <strong>Variable Type</strong> as Int32 and <strong>‘BooleanVar’ </strong>asBoolean variable.</p>



<p><strong>Step 3: Add Input Dialog box</strong> -&gt;add Dialog Title as “Enter the year“ &nbsp;and Input Label as “Year Value”</p>



<p><strong>Step 4: </strong>Add If Condition for leap year</p>



<p>Year Mod 4=0&nbsp;</p>



<p><strong>Step 5:</strong> If the condition is True then:</p>



<ul class="wp-block-list">
<li>Assign Activity -&gt; Add</li>
</ul>



<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BooleanVar=True</p>



<ul class="wp-block-list">
<li>Add Message Box Activity and to Display message for e.g&nbsp; “True Year 2020 is leap year”</li>
</ul>



<p>Add message as below:</p>



<p>BooleanVar.ToString&nbsp; + &#8221; Year &#8221;&nbsp; +&nbsp; Year.ToString&nbsp; +&nbsp; &#8221; is a leap year&#8221;</p>



<p>Note: In message box only String values can be display here we have to display Boolean and Integer variable so have to use convert to string function.</p>



<p><strong>Step 6: :</strong> If the condition is False then:</p>



<p>Add Message Box Activity and to Display message for e.g&nbsp; “True Year 2021 is not&nbsp; leap year”</p>



<p>Add message as below:</p>



<p>BooleanVar.ToString&nbsp; + &#8221; Year&nbsp; &#8221; + Year.ToString +&#8221;&nbsp; is not leap year&#8221;</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="496" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-33-1024x496.png" alt="" class="wp-image-1003" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-33-1024x496.png 1024w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-33-300x145.png 300w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-33-768x372.png 768w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-33.png 1093w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="762" height="414" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-34.png" alt="" class="wp-image-1004" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-34.png 762w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-34-300x163.png 300w" sizes="(max-width: 762px) 100vw, 762px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="761" height="487" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-35.png" alt="" class="wp-image-1005" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-35.png 761w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-35-300x192.png 300w" sizes="(max-width: 761px) 100vw, 761px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="700" height="344" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-36.png" alt="" class="wp-image-1006" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-36.png 700w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-36-300x147.png 300w" sizes="(max-width: 700px) 100vw, 700px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="772" height="445" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-37.png" alt="" class="wp-image-1007" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-37.png 772w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-37-300x173.png 300w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-37-768x443.png 768w" sizes="(max-width: 772px) 100vw, 772px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="687" height="268" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-38.png" alt="" class="wp-image-1008" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-38.png 687w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-38-300x117.png 300w" sizes="(max-width: 687px) 100vw, 687px" /></figure>



<p></p>



<p><strong>UiPath Tutorial 7: Flowchart workflow</strong></p>



<p><strong>Compare two numbers:</strong></p>



<ol class="wp-block-list">
<li><strong>Add flowchart workflow type.</strong></li>



<li><strong>Create two number variables –RandomNumber, GuessNumber- Number Variables</strong></li>



<li><strong>Generate random number using the random() function –new random().Next(1,10) and assign to RandomVariable</strong></li>



<li><strong>Take user Input from number&nbsp; from 1 to 10 and assign it to GuessNumber &nbsp;variable –Input dialog</strong></li>
</ol>



<p><strong>Note</strong>: Add Variable as Output Result for each Input dialog box Properties</p>



<p>5. <strong>Condition-&gt;Compare RandomNumber,GuessNumber</strong></p>



<p><strong>GuessNumber&gt;=RandomNumber</strong></p>



<p><strong>6. Take Decision according to the condition</strong></p>



<p><strong>If the </strong>condition is true (GuessNumber&gt;=Randomnumber) then display a <strong>message</strong></p>



<p>-“Your guessed number is equal to or greater than Random Number”.</p>



<p><strong>7. If condition is False (GuessNumber&lt;Randomnumber) then display message</strong></p>



<p>-“Your guessed number is equal to or smaller than Random Number”. </p>



<p><strong>8. And to display e.g. ‘Random Number is 8 and Guess Number is 6’. Add below message in message box.</strong></p>



<p>&#8220;Random Number is&nbsp; &#8221;&nbsp; + RandomNumber.ToString +&nbsp; &#8220;and Guess Number is &#8221; + GuessNumber.ToString</p>



<figure class="wp-block-image size-full"><img decoding="async" width="734" height="447" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-40.png" alt="" class="wp-image-1010" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-40.png 734w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-40-300x183.png 300w" sizes="(max-width: 734px) 100vw, 734px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="886" height="262" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-41.png" alt="" class="wp-image-1011" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-41.png 886w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-41-300x89.png 300w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-41-768x227.png 768w" sizes="(max-width: 886px) 100vw, 886px" /></figure>



<p><strong>If a condition is true (GuessNumber&gt;=Randomnumber) then display message</strong></p>



<p><strong>-“Your guessed number is equal to or greater than Random Number”.</strong></p>



<p><strong>And to display e.g&nbsp; ‘Random Number is 8 and Guess Number is 6’. Add below message in the message box.</strong></p>



<p>&#8220;Random Number is&nbsp; &#8221;&nbsp; + RandomNumber.ToString +&nbsp; &#8220;and Guess Number is &#8221; + GuessNumber.ToString</p>



<figure class="wp-block-image size-full"><img decoding="async" width="476" height="215" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-42.png" alt="" class="wp-image-1012" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-42.png 476w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-42-300x136.png 300w" sizes="(max-width: 476px) 100vw, 476px" /></figure>



<p><strong>If condition is False (GuessNumber&lt;Randomnumber) then display message</strong></p>



<p>-“Your guessed number is equal to or smaller than Random Number”.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="359" height="107" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-43.png" alt="" class="wp-image-1013" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-43.png 359w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-43-300x89.png 300w" sizes="(max-width: 359px) 100vw, 359px" /></figure>



<p><strong>Debug File-&gt;Run File</strong>: Enter Guess Number=8</p>



<figure class="wp-block-image size-full"><img decoding="async" width="757" height="548" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-44.png" alt="" class="wp-image-1014" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-44.png 757w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-44-300x217.png 300w" sizes="(max-width: 757px) 100vw, 757px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="758" height="522" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-45.png" alt="" class="wp-image-1015" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-45.png 758w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-45-300x207.png 300w" sizes="(max-width: 758px) 100vw, 758px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="748" height="445" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-46.png" alt="" class="wp-image-1016" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-46.png 748w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-46-300x178.png 300w" sizes="(max-width: 748px) 100vw, 748px" /></figure>



<p><strong>Debug File-&gt;Run File</strong>: Enter Guess Number=3</p>



<figure class="wp-block-image size-full"><img decoding="async" width="735" height="456" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-47.png" alt="" class="wp-image-1017" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-47.png 735w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-47-300x186.png 300w" sizes="(max-width: 735px) 100vw, 735px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="722" height="445" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-48.png" alt="" class="wp-image-1018" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-48.png 722w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-48-300x185.png 300w" sizes="(max-width: 722px) 100vw, 722px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="545" height="224" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-49.png" alt="" class="wp-image-1019" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-49.png 545w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-49-300x123.png 300w" sizes="(max-width: 545px) 100vw, 545px" /></figure>



<p><strong>State Machine workflow:</strong></p>



<p>A state machine is a type of automation that uses a finite number of states in its execution. It can go into a state when it is triggered by an activity, and it exits that state when another activity is triggered.</p>



<p>Two activities – <strong>State</strong> and <strong>Final State .</strong>Both of these activities can be expanded by double-clicking them, to view more information and edit them.<strong></strong></p>



<p><strong>State activity</strong>: conatins Entry, Exit and Transition. The&nbsp;<strong>Entry</strong>&nbsp;and&nbsp;<strong>Exit</strong>&nbsp;sections enable you to add entry and exit triggers for the selected state, while the&nbsp;<strong>Transition(s)</strong>&nbsp;section displays all the transitions linked to the selected state.</p>



<p>Transitions are expanded when you double-click them, just like the&nbsp;<strong>State</strong>&nbsp;activity. They contain three sections,&nbsp;<strong>Trigger</strong>,&nbsp;<strong>Condition</strong>&nbsp;and&nbsp;<strong>Action</strong>, that enable you to add a trigger for the next state, or add a condition under which an activity or sequence is to be executed.</p>



<p><strong>Final State: </strong>It only contains Entry.It specifies the action to occure when the state is transioned to.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>



<p><strong>Tutorial 08: </strong>Guess any number between 1 to 10 and find Guess Number is equal to random number.</p>



<p>For this need to verify the below possible state:</p>



<p>Guess Number &gt;Random Number &#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Retry</p>



<p>Guess Number &lt;Random Number &#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Retry</p>



<p>Guess Number =Random Number &#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Final</p>



<p><strong>Steps:</strong></p>



<p>1. Create a blank Process –state machine workflow demo</p>



<p>2. On design tab-Main.xaml- double click on that and select state machine workflow-double click on it.</p>



<p>3. Select <strong>state</strong> activity to generate the random number. Double-click the activity. This&nbsp;State&nbsp;activity is displayed expanded in the&nbsp;Designer&nbsp;panel.</p>



<p>4. Create two variable RandomNumber and GuessNumebr.</p>



<p>5. Assign activity in <strong>entry</strong></p>



<p>&nbsp;&nbsp;&nbsp;&nbsp; RandomNumber= new Random().Next(1, 10)</p>



<p>6. Add message box activity in <strong>Exit</strong> criteria “Random number is generated”</p>



<p>7. Return to main state machine workflow and add another <strong>state</strong> activity, to enter Guess Number. Add Input dialog box add Dialog Title and Input label and store variable as output result of Input Dialog box properties.</p>



<p>8. Return to the main project view and create a <strong>transition</strong> that points from the Guess Number state to itself.(Display Name -&gt;Trysmaller).</p>



<p>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Add condition Guessnumber &gt; RandomNumber</p>



<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Add message box in Action “&#8221;Guess Number is greater than Random Number try for smaller number&#8221;”.</p>



<ul class="wp-block-list">
<li>Return to Main project view and create a one more <strong>transition</strong> that points from the Guess Number state to itself.(Display Name -&gt;Trygreater).</li>
</ul>



<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Add condition Guessnumber &lt;RandomNumber</p>



<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Add message box in Action “&#8221;Guess Number is smaller than Random Number try for greater number&#8221;”.</p>



<ol class="wp-block-list">
<li>Return to Main project view and add <strong>Final State </strong>(Display Name-&gt;Correct Number).</li>
</ol>



<p>In <strong>transition</strong> add <strong>condition</strong> RandomNumber=GuessNumber.</p>



<ol class="wp-block-list">
<li>Return to Main project view and connect a <strong>transition</strong> from the&nbsp;<strong>Guess Number</strong>&nbsp;activity to the&nbsp;<strong>Final State</strong>.</li>
</ol>



<p>Add message box and display message &#8220;Congratulation you guessed the correct number&#8221;.</p>



<p>Add one more message box to display random number &#8220;The Random Number is &#8221; + RandomNumber.ToString”.</p>



<ol class="wp-block-list">
<li>The Final Project will look as following screenshot.</li>
</ol>



<figure class="wp-block-image size-full"><img decoding="async" width="760" height="544" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-50.png" alt="" class="wp-image-1020" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-50.png 760w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-50-300x215.png 300w" sizes="(max-width: 760px) 100vw, 760px" /></figure>



<ol class="wp-block-list">
<li>13. Run File.</li>
</ol>



<figure class="wp-block-image size-full"><img decoding="async" width="202" height="131" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-51.png" alt="" class="wp-image-1021"/></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="408" height="347" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-52.png" alt="" class="wp-image-1022" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-52.png 408w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-52-300x255.png 300w" sizes="(max-width: 408px) 100vw, 408px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="408" height="347" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-53.png" alt="" class="wp-image-1023" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-53.png 408w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-53-300x255.png 300w" sizes="(max-width: 408px) 100vw, 408px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="362" height="499" src="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-54.png" alt="" class="wp-image-1024" srcset="https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-54.png 362w, https://www.dotnetguide.com/wp-content/uploads/2022/02/UI-Path-Process-54-218x300.png 218w" sizes="(max-width: 362px) 100vw, 362px" /></figure>



<p></p>
<p>The post <a href="https://www.dotnetguide.com/uipath-tutorials/">UIPath Tutorial</a> appeared first on <a href="https://www.dotnetguide.com">Dot Net Guide</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dotnetguide.com/uipath-tutorials/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>C# Conditional Loops</title>
		<link>https://www.dotnetguide.com/csharp-conditional-loops/</link>
					<comments>https://www.dotnetguide.com/csharp-conditional-loops/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 17 Apr 2023 15:09:02 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://www.dotnetguide.com/?p=1462</guid>

					<description><![CDATA[<p>In the previous article, we learned about&#160;C# Conditional Statements&#160;and now in this article we will learn about C# Conditional Loops using various examples. In&#160;C#, conditional loops are used to repeatedly execute a block of code as long as a specific condition is true. Here are some of the most commonly used conditional loops: 1.while loop:&#160;The ... </p>
<p class="read-more-container"><a title="C# Conditional Loops" class="read-more button" href="https://www.dotnetguide.com/csharp-conditional-loops/#more-1462">Read more<span class="screen-reader-text">C# Conditional Loops</span></a></p>
<p>The post <a href="https://www.dotnetguide.com/csharp-conditional-loops/">C# Conditional Loops</a> appeared first on <a href="https://www.dotnetguide.com">Dot Net Guide</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In the previous article, we learned about&nbsp;<a href="https://www.dotnetguide.com/csharp-conditional-statements/" target="_blank" rel="noreferrer noopener">C# Conditional Statements</a>&nbsp;and now in this article we will learn about C# Conditional Loops using various examples.</p>



<p>In&nbsp;<a href="https://learn.microsoft.com/en-us/dotnet/csharp/tour-of-csharp/" target="_blank" rel="noreferrer noopener">C#</a>, conditional loops are used to repeatedly execute a block of code as long as a specific condition is true. Here are some of the most commonly used conditional loops:</p>



<p><strong>1</strong>.<strong>while loop:</strong>&nbsp;The while loop is used to execute a block of code repeatedly while a condition is true. The syntax is as follows:</p>



<pre class="wp-block-code"><code>while (condition)
{
    // code to be executed
}
</code></pre>



<p>Here, is the example of while loop,</p>



<pre class="wp-block-code"><code>int i = 1;
while (i &lt;= 10)
{
    Console.WriteLine(i);
    i++;
}
</code></pre>



<p>This code will repeatedly print the value of&nbsp;i&nbsp;as long as it is less than or equal to 10. The output will be:</p>



<pre class="wp-block-code"><code>1
2
3
4
5
6
7
8
9
10
</code></pre>



<h4 class="wp-block-heading"><strong>Nested while Loop</strong></h4>



<p>C# allows&nbsp;<code>while</code>&nbsp;loops inside another&nbsp;<code>while</code>&nbsp;loop, as shown below. However, it is not recommended to use nested&nbsp;<code>while</code>&nbsp;loop because it makes it hard to debug and maintain.</p>



<pre class="wp-block-code"><code>int i = 0, j = 1;

while (i &lt; 2)
{
    Console.WriteLine("i = {0}", i);
    i++;

    while (j &lt; 2)
    {
        Console.WriteLine("j = {0}", j);
        j++;
    }
}</code></pre>



<p>The output of this code will be as below:</p>



<pre class="wp-block-code"><code>i = 0
j = 1
i = 1</code></pre>



<p><strong>2. do-while loop:</strong>&nbsp;The do-while loop is similar to the while loop, but the condition is checked at the end of the loop instead of the beginning. This ensures that the loop body is executed at least once. The syntax is as follows:</p>



<pre class="wp-block-code"><code>do
{
    // code to be executed
} while (condition);
</code></pre>



<p>Here is the example of do-while loop,</p>



<pre class="wp-block-code"><code>int i = 1;
do
{
    Console.WriteLine(i);
    i++;
} while (i &lt;= 10);
</code></pre>



<p>This code will execute the block of code at least once and then repeatedly execute it as long as the condition is true. The output will be the same as the previous example:</p>



<pre class="wp-block-code"><code>1
2
3
4
5
6
7
8
9
10
</code></pre>



<p>Note that the difference between the while and do-while loops is that the while loop tests the condition at the beginning, while the do-while loop tests the condition at the end. Therefore, the block of code inside a do-while loop will always execute at least once, even if the condition is initially false.</p>



<p><strong>3.for loop:</strong>&nbsp;The for loop is used to execute a block of code a specific number of times. It is often used when the number of iterations is known in advance. The syntax is as follows:</p>



<pre class="wp-block-code"><code>for (initialization; condition; iteration)
{
    // code to be executed
}
here’s an example of a for loop in C#:
for (int i = 0; i &lt; 5; i++)
{
    Console.WriteLine(i);
}
</code></pre>



<p>In this example, the loop will execute 5 times because the condition&nbsp;<strong>i &lt; 5</strong>&nbsp;is true. The loop consists of three parts separated by semicolons:</p>



<ol class="wp-block-list" type="1"><li>Initialization:&nbsp;int&nbsp;<strong>i = 0</strong>;&nbsp;initializes the loop control variable&nbsp;<strong>i</strong><strong>&nbsp;to 0</strong>.</li><li>Condition:&nbsp;<strong>i &lt; 5</strong>;&nbsp;checks whether the loop should continue executing. As long as the condition is true, the loop will execute.</li><li>Iteration:&nbsp;<strong>i++</strong>&nbsp;increments the value of&nbsp;<strong>i</strong><strong>&nbsp;by 1</strong>&nbsp;after each iteration of the loop.</li></ol>



<p>The output of this code will be:</p>



<pre class="wp-block-code"><code>0
1
2
3
4
</code></pre>



<p>In this example, the loop control variable&nbsp;i&nbsp;is used to print the values from&nbsp;<strong>0 to 4</strong>&nbsp;to the console. However, the loop control variable can be used for other purposes as well, such as accessing elements in an array or collection.</p>



<p><strong>4. for each</strong> <strong>loop</strong>:&nbsp;The for each loop is used to iterate over the elements of an array or a collection. It automatically initializes an index variable and iterates over the elements until the end of the collection is reached. The syntax is as follows:</p>



<pre class="wp-block-code"><code>{
    // code to be executed
}
here’s an example of a foreach loop in C#:
int&#91;] numbers = { 1, 2, 3, 4, 5 };
foreach (int number in numbers)
{
    Console.WriteLine(number);
}
</code></pre>



<p>In this example, the loop will iterate over each element in the&nbsp;numbers&nbsp;array and print its value to the console. The syntax of the foreach loop is as follows:</p>



<pre class="wp-block-code"><code>foreach (type variable in collection)
{
    // code to be executed
}
</code></pre>



<p>Here,&nbsp;type&nbsp;specifies the data type of the elements in the collection,&nbsp;variable&nbsp;is a temporary variable that represents each element in the collection, and&nbsp;collection&nbsp;is the collection of elements to be iterated over. The loop will automatically initialize the&nbsp;variable&nbsp;with each element in the collection and execute the code inside the loop body.</p>



<p>The output of this code will be:</p>



<pre class="wp-block-code"><code>1
2
3
4
5
</code></pre>



<p>In this example, the loop iterates over each element in the&nbsp;numbers&nbsp;array and prints its value to the console. The loop control variable&nbsp;number&nbsp;is used to access each element in the array. However, the loop control variable can be named whatever you like, as long as it is of the same type as the elements in the collection.</p>
<p>The post <a href="https://www.dotnetguide.com/csharp-conditional-loops/">C# Conditional Loops</a> appeared first on <a href="https://www.dotnetguide.com">Dot Net Guide</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dotnetguide.com/csharp-conditional-loops/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>C# Conditional Statements</title>
		<link>https://www.dotnetguide.com/csharp-conditional-statements/</link>
					<comments>https://www.dotnetguide.com/csharp-conditional-statements/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 11 Apr 2023 04:15:51 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Tutorials]]></category>
		<guid isPermaLink="false">https://www.dotnetguide.com/?p=1349</guid>

					<description><![CDATA[<p>In Previous article we learned about&#160;C# Classes&#160;and&#160;Objects&#160;and now in this article we will learn about C# Conditional Statements using various examples. C# Conditional Statement In C#, conditional statements are used to execute specific blocks of code based on certain conditions. Decision-making statements require a few conditions that can be evaluated by the program and set ... </p>
<p class="read-more-container"><a title="C# Conditional Statements" class="read-more button" href="https://www.dotnetguide.com/csharp-conditional-statements/#more-1349">Read more<span class="screen-reader-text">C# Conditional Statements</span></a></p>
<p>The post <a href="https://www.dotnetguide.com/csharp-conditional-statements/">C# Conditional Statements</a> appeared first on <a href="https://www.dotnetguide.com">Dot Net Guide</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In Previous article we learned about&nbsp;<a href="https://www.dotnetguide.com/csharp-classes-and-objects/#more-1174" target="_blank" rel="noreferrer noopener">C# Classes&nbsp;and&nbsp;Objects</a>&nbsp;and now in this article we will learn about C# Conditional Statements using various examples. </p>



<figure class="wp-block-image size-full"><img decoding="async" width="626" height="324" src="https://www.dotnetguide.com/wp-content/uploads/2023/04/C-Condtional-Statements.png" alt="C# Conditional Statements" class="wp-image-1458" srcset="https://www.dotnetguide.com/wp-content/uploads/2023/04/C-Condtional-Statements.png 626w, https://www.dotnetguide.com/wp-content/uploads/2023/04/C-Condtional-Statements-300x155.png 300w" sizes="(max-width: 626px) 100vw, 626px" /></figure>



<h3 class="wp-block-heading"><strong> C# Conditional Statement</strong></h3>



<p>In <a href="https://learn.microsoft.com/en-us/dotnet/csharp/tour-of-csharp/" target="_blank" rel="noreferrer noopener">C#</a>, <strong>conditional statements</strong> are used to execute specific blocks of code based on certain conditions. </p>



<p>Decision-making statements require a few conditions that can be evaluated by the program and set of statements that can be executed if the condition evaluates as true or another statement that can be executed when the condition values as false.</p>



<p>In this tutorial, we will be explaining how a conditional operator works with proper syntax explanation and some interesting examples. We will also be looking into nested and other different conditional statements.</p>



<p><strong>Lets have look on flow chart of Conditional statement ,</strong></p>



<figure class="wp-block-image size-full"><img decoding="async" width="391" height="482" src="https://www.dotnetguide.com/wp-content/uploads/2023/04/image.png" alt="" class="wp-image-1357" srcset="https://www.dotnetguide.com/wp-content/uploads/2023/04/image.png 391w, https://www.dotnetguide.com/wp-content/uploads/2023/04/image-243x300.png 243w" sizes="(max-width: 391px) 100vw, 391px" /><figcaption><br>Here, are the three types of conditional statements in C#:</figcaption></figure>



<p><strong>1.if statement:</strong> The if statement is used to execute a block of code only if a certain condition is true. Here is the syntax:</p>



<pre class="wp-block-code"><code>if (condition)
{
    // code to be executed if the condition is true
}
</code></pre>



<p>here is the example of If statement,</p>



<pre class="wp-block-code"><code>using System;

namespace Conditional
{
	class IfStatement
	{
		public static void Main(string&#91;] args)
		{
			int number = 2;
			if (number &lt; 5)
			{
				Console.WriteLine("{0} is less than 5", number);
			}

			Console.WriteLine("This statement is always executed.");
		}
	}
}</code></pre>



<p>When we run the program, the output will be:</p>



<pre class="wp-block-code"><code>2 is less than 5
This statement is always executed.</code></pre>



<p>The value of&nbsp;<strong><var>number</var>&nbsp;</strong>is initialized to 2. So the expression&nbsp;<code><strong>number &lt; 5</strong></code>&nbsp;is evaluated to&nbsp;<code><strong>true</strong></code>. Hence, the code inside the if block are executed. The code after the if statement will always be executed irrespective to the expression.</p>



<p>Now, change the value of&nbsp;<strong><var>number</var>&nbsp;</strong>to something greater than&nbsp;<code><strong>5</strong></code>, say&nbsp;<code><strong>10</strong></code>. When we run the program the output will be:</p>



<pre class="wp-block-code"><code>This statement is always executed.</code></pre>



<p>The expression&nbsp;<code><strong>number &lt; 5</strong></code>&nbsp;will return&nbsp;<code><strong>false</strong></code>, hence the code inside if block won&#8217;t be executed.</p>



<p><strong>2</strong>. <strong>if-else statement:</strong> The if-else statement is used to execute one block of code <strong>if a condition is true</strong>, and another block of code <strong>if the condition is false</strong>. Here is the syntax:</p>



<pre class="wp-block-code"><code>if (condition)
{
    // code to be executed if the condition is true
}
else
{
    // code to be executed if the condition is false
}
</code></pre>



<p>Here is the example of If else statement,</p>



<pre class="wp-block-code"><code>using System;

namespace Conditional
{
	class IfElseStatement
	{
		public static void Main(string&#91;] args)
		{
			int number = 12;

			if (number &lt; 5)
			{
				Console.WriteLine("{0} is less than 5", number);
			}
			else
			{
				Console.WriteLine("{0} is greater than or equal to 5", number);
			}

			Console.WriteLine("This statement is always executed.");
		}
	}
}</code></pre>



<p>When we run the program, the output will be:</p>



<pre class="wp-block-code"><code>12 is greater than or equal to 5
This statement is always executed.</code></pre>



<p>Here, the value of&nbsp;<strong><var>number</var>&nbsp;</strong>is initialized to&nbsp;<code><strong>12</strong></code>. So the expression&nbsp;<strong><code>number &lt; 5</code>&nbsp;</strong>is evaluated to&nbsp;<code>false</code>. Hence, the code inside the else block are executed. The code after the if..else statement will always be executed irrespective to the expression.</p>



<p>Now, change the value of number to something less than&nbsp;<code>5</code>, say&nbsp;<code>2</code>. When we run the program the output will be:</p>



<pre class="wp-block-code"><code>2 is less than 5
This statement is always executed.</code></pre>



<p>The expression&nbsp;<code><strong>number &lt; 5</strong></code>&nbsp;will return true, hence the code inside if block will be executed.</p>



<p><strong>3</strong>. <strong>switch statement:</strong> The switch statement is used to execute different blocks of code depending on the value of a variable. Here is the syntax:</p>



<pre class="wp-block-code"><code>switch (variable)
{
    case value1:
        // code to be executed if variable equals value1
        break;
    case value2:
        // code to be executed if variable equals value2
        break;
    // add more cases as needed
    default:
        // code to be executed if none of the cases are true
        break;
}
</code></pre>



<p>The switch statement evaluates the&nbsp;<strong><var>expression</var>&nbsp;</strong>(or&nbsp;<var><strong>variable</strong></var>) and compare its value with the values (or expression) of each case (<strong><var>value1</var>,&nbsp;<var>value2</var>, …</strong>). When it finds the matching value, the statements inside that case are executed.</p>



<p>But, if none of the above cases matches the expression, the statements inside&nbsp;<strong><code>default</code>&nbsp;</strong>block is executed. The default statement at the end of switch is similar to the else block in if else statement.</p>



<p>However a problem with the switch statement is, when the matching value is found, it executes all statements after it until the end of switch block.</p>



<p>To avoid this, we use&nbsp;<code>break</code>&nbsp;statement at the end of each case. The break statement stops the program from executing non-matching statements by terminating the execution of switch statement.</p>



<pre class="wp-block-code"><code>using System;
 
namespace Conditional
{
    class SwitchCase
    {
        public static void Main(string&#91;] args)
        {
            char ch;
            Console.WriteLine("Enter an alphabet");
            ch = Convert.ToChar(Console.ReadLine());
 
            switch(Char.ToLower(ch))
            {
                case 'a':
                    Console.WriteLine("Vowel");
                    break;
                case 'e':
                    Console.WriteLine("Vowel");
                    break;
                case 'i':
                    Console.WriteLine("Vowel");
                    break;
                case 'o':
                    Console.WriteLine("Vowel");
                    break;
                case 'u':
                    Console.WriteLine("Vowel");
                    break;
                default:
                    Console.WriteLine("Not a vowel");
                    break;
            }
        }
    }
}</code></pre>



<p>When we run the program, the output will be:</p>



<pre class="wp-block-code"><code>Enter an alphabet
X
Not a vowel</code></pre>



<p>In this example, the user is prompted to enter an alphabet. The alphabet is converted to lowercase by using&nbsp;<code><strong>ToLower()</strong></code>&nbsp;method if it is in uppercase.</p>



<p>Then, the switch statement checks whether the alphabet entered by user is any of&nbsp;<strong><code>a, e, i, o or u</code>.</strong></p>



<p>If one of the case matches,&nbsp;<strong><code>Vowel</code>&nbsp;</strong>is printed otherwise the control goes to default block and&nbsp;<code><strong>Not a vowel</strong></code>&nbsp;is printed as output.</p>



<p><strong>4.Nested If Statement:</strong></p>



<p>In C#, nested if statements are used to execute a set of instructions if the condition in the outer if statement is true, and then execute another set of instructions if the condition in the inner if statement is true as well.</p>



<p>Here&#8217;s an example of nested if statements in C#:</p>



<pre class="wp-block-code"><code>if (condition1)
{
    // code to execute if condition1 is true

    if (condition2)
    {
        // code to execute if condition1 and condition2 are true
    }
}
else
{
    // code to execute if condition1 is false
}
</code></pre>



<p>Here is the example of Nested if statement,</p>



<pre class="wp-block-code"><code>int x = 10;
int y = 20;

if (x == 10)
{
   Console.WriteLine("x is equal to 10");
   if (y == 20)
   {
      Console.WriteLine("y is equal to 20");
   }
   else
   {
      Console.WriteLine("y is not equal to 20");
   }
}
else
{
   Console.WriteLine("x is not equal to 10");
}
</code></pre>



<p>In this example, there are two variables &#8216;<code><strong>x</strong></code>&#8216; and &#8216;<code><strong>y</strong></code>&#8216;. The outer if statement checks whether &#8216;<code><strong>x</strong></code>&#8216; is equal to 10. If it is, then the inner if statement checks whether &#8216;<code><strong>y</strong></code>&#8216; is equal to 20. If both conditions are true, then the program outputs the message &#8220;x is equal to 10&#8221; and &#8220;y is equal to 20&#8221;. If &#8216;<code><strong>y</strong></code>&#8216; is not equal to 20, then the program outputs the message &#8220;y is not equal to 20&#8221;. If &#8216;<code><strong>x</strong></code>&#8216; is not equal to 10, then the program outputs the message &#8220;x is not equal to 10&#8221;.</p>
<p>The post <a href="https://www.dotnetguide.com/csharp-conditional-statements/">C# Conditional Statements</a> appeared first on <a href="https://www.dotnetguide.com">Dot Net Guide</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dotnetguide.com/csharp-conditional-statements/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>C# Classes and Objects</title>
		<link>https://www.dotnetguide.com/csharp-classes-and-objects/</link>
					<comments>https://www.dotnetguide.com/csharp-classes-and-objects/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 05 Apr 2023 04:03:56 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://www.dotnetguide.com/?p=1174</guid>

					<description><![CDATA[<p>In this tutorial, you will learn about the concept of C# classes and objects with the help of examples. In Previous article we learned about C# Program structure and data types and now in this article we will learn about C# classes and objects using various examples. Similar to most of the object-oriented programming languages ... </p>
<p class="read-more-container"><a title="C# Classes and Objects" class="read-more button" href="https://www.dotnetguide.com/csharp-classes-and-objects/#more-1174">Read more<span class="screen-reader-text">C# Classes and Objects</span></a></p>
<p>The post <a href="https://www.dotnetguide.com/csharp-classes-and-objects/">C# Classes and Objects</a> appeared first on <a href="https://www.dotnetguide.com">Dot Net Guide</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p></p>



<h3 class="wp-block-heading"><em><strong>In this tut</strong></em><strong><em>orial, you will learn about the concept of C# classes and objects with the help of examples.</em></strong></h3>



<figure class="wp-block-image size-full"><img decoding="async" width="626" height="324" src="https://www.dotnetguide.com/wp-content/uploads/2023/04/C-Classes-and-Objects.jpg" alt="C# Classes and Objects" class="wp-image-1316" srcset="https://www.dotnetguide.com/wp-content/uploads/2023/04/C-Classes-and-Objects.jpg 626w, https://www.dotnetguide.com/wp-content/uploads/2023/04/C-Classes-and-Objects-300x155.jpg 300w" sizes="(max-width: 626px) 100vw, 626px" /></figure>



<h2 class="wp-block-heading"></h2>



<p>In Previous article we learned about <a href="https://www.dotnetguide.com/csharp-program-structure-and-syntax/" target="_blank" rel="noreferrer noopener">C# Program structure</a> and <a href="https://www.dotnetguide.com/csharp-data-types-and-variables-with-examples/" target="_blank" rel="noreferrer noopener">data types</a> and now in this article we will learn about C# classes and objects using various examples. Similar to most of the object-oriented programming languages C# also has inbuilt support for C# classes and objects.</p>



<h2 class="wp-block-heading"><strong>C# Classes and Objects</strong></h2>



<p>In C#, a class is a blueprint or a template for creating objects. An object is an instance of a class. C# is associated with classes and objects, along with its attributes and methods.</p>



<p>To work with objects, we need to perform the following activities:</p>



<ul class="wp-block-list"><li>create a class</li><li>create objects from the class</li></ul>



<p><strong>C# Class:</strong></p>



<p>Before we learn about objects, we need to understand the working of classes. Class is the blueprint for the object.</p>



<p>Here&#8217;s an example of a simple class in C#:</p>



<pre class="wp-block-code"><code>public class Car
{
    public string Make;
    public string Model;
    public int Year;

    public void Drive()
    {
        Console.WriteLine("Driving the {0} {1}...", Make, Model);
    }
}
</code></pre>



<p>In this example, we have defined a class called &#8220;<strong>Car</strong>&#8220;. It has three public properties: &#8220;<strong>Make</strong>&#8220;, &#8220;<strong>Model</strong>&#8220;, and &#8220;<strong>Year</strong>&#8220;, which can be accessed from outside the class. It also has a public method called &#8220;<strong>Drive</strong>&#8221; that writes a message to the console.</p>



<p><strong>C# Objects</strong>:</p>



<p>An object is an instance of a class. Suppose<strong>,</strong> to create an object of this class, we can use the &#8220;<strong>new</strong>&#8221; keyword:</p>



<pre class="wp-block-code"><code>Classname obj= new Classname();</code></pre>



<p>This creates a new instance of the &#8220;<strong>Car</strong>&#8221; class and assigns it to the variable &#8220;<strong>myCar</strong>&#8220;. We can then set the properties of the object like this:</p>



<pre class="wp-block-code"><code>Car myCar= new Car();</code></pre>



<pre class="wp-block-code"><code>myCar.Make = "Toyota";
myCar.Model = "Corolla";
myCar.Year = 2018;</code></pre>



<p>And we can call the &#8220;Drive&#8221; method like this:</p>



<pre class="wp-block-code"><code>myCar.Drive();</code></pre>



<p>This will output the message &#8220;<strong>Driving the Toyota Corolla&#8230;</strong>&#8221; to the console.</p>



<p>Classes can have constructors, which are special methods that are called when an object is created. Constructors can be used to initialize the object&#8217;s properties or perform other setup tasks. Here&#8217;s an example of a class with a constructor:</p>



<pre class="wp-block-code"><code>public class Person
{
    public string Name;
    public int Age;

    public Person(string name, int age)
    {
        Name = name;
        Age = age;
    }

    public void SayHello()
    {
        Console.WriteLine("Hello, my name is {0} and I'm {1} years old.", Name, Age);
    }
}
</code></pre>



<p>In this example, we have a class called <strong>&#8220;Person&#8221;</strong> that has two properties: <strong>&#8220;Name&#8221;</strong> and <strong>&#8220;Age&#8221;</strong>. We also have a constructor that takes two parameters: <strong>&#8220;name&#8221;</strong> and <strong>&#8220;age&#8221;</strong>. This constructor sets the <strong>&#8220;Name&#8221;</strong> and <strong>&#8220;Age&#8221; </strong>properties of the object.</p>



<p>We can create an instance of the &#8220;<strong>Person</strong>&#8221; class like this:</p>



<pre class="wp-block-code"><code>Person john = new Person("John", 30);
</code></pre>



<p>This creates a new instance of the <strong>&#8220;Person&#8221;</strong> class with the <strong>&#8220;Name&#8221; </strong>property set to <strong>&#8220;John&#8221; </strong>and the <strong>&#8220;Age&#8221;</strong> property set to 30. We can then call the &#8220;SayHello&#8221; method like this:</p>



<pre class="wp-block-code"><code>john.SayHello();
</code></pre>



<p>This will output the message <strong>&#8220;Hello, my name is John and I&#8217;m 30 years old.&#8221;</strong> to the console.</p>



<h2 class="wp-block-heading"><strong>Constructor</strong> : </h2>



<p>In C#, a constructor is a special method that is used to initialize objects when they are created. It has the same name as the class and does not have a return type, not even void.</p>



<p>Here is an example of a constructor in C#:</p>



<pre class="wp-block-code"><code>public class Person
{
    public string Name { get; set; }
    public int Age { get; set; }

    // Constructor with parameters
    public Person(string name, int age)
    {
        Name = name;
        Age = age;
    }

    // Default constructor
    public Person()
    {
        Name = "John Doe";
        Age = 18;
    }
}

// Creating an object of the Person class using the constructor with parameters
Person person1 = new Person("Alice", 25);

// Creating an object of the Person class using the default constructor
Person person2 = new Person();
</code></pre>



<p>In this example, we have defined a class &#8216;<code>Person</code>&#8216; with two properties, <strong>&#8216;<code>Name</code>&#8216;</strong> and <strong>&#8216;<code>Age</code>&#8216;</strong>. We have also defined two constructors for this class &#8211; one that takes two parameters (<strong>&#8216;<code>name</code>&#8216; </strong>and <code>'<strong>age'</strong></code>) and one that doesn&#8217;t take any parameters.</p>



<p>When we create an object of the <strong>&#8216;<code>Person'</code></strong> class using the constructor with parameters, we pass in values for the &#8216;<strong><code>name</code>&#8216; </strong>and <strong>&#8216;<code>age</code>&#8216;</strong> parameters. These values are then used to initialize the &#8216;<strong><code>Name</code>&#8216; </strong>and &#8216;<code><strong>Age</strong></code>&#8216; properties of the object.</p>



<p>When we create an object of the <code>Person</code> class using the default constructor, the &#8216;<strong><code>Name</code></strong>&#8216; property is set to &#8220;John Doe&#8221; and the <strong>&#8216;<code>Age</code>&#8216; </strong>property is set to 18 by default.</p>



<h2 class="wp-block-heading"><strong>Methods</strong>:</h2>



<p>Methods are functions that are defined within a class. They are used to perform specific tasks or operations. C# is a popular programming language used to build a variety of applications ranging from desktop applications to web services. </p>



<p>Here&#8217;s an example of a method in C#:</p>



<pre class="wp-block-code"><code>// Define a method to calculate the sum of two integers
public int CalculateSum(int a, int b)
{
    return a + b;
}
</code></pre>



<p>In the example above, we defined a method called &#8216;<strong><code>CalculateSum</code>&#8216; </strong>that takes two integers as arguments (<strong>&#8216;<code>a'</code></strong> and <strong>&#8216;<code>b'</code></strong>) and returns their sum. Here are the key parts of this method:</p>



<ul class="wp-block-list"><li>&#8216;<code><strong>public</strong></code>&#8216;: This keyword indicates that the method is accessible from outside the class in which it&#8217;s defined.</li><li>&#8216;<code><strong>int</strong></code>&#8216;: This is the return type of the method. In this case, the method returns an integer value.</li><li><strong>&#8216;<code>CalculateSum</code>&#8216;</strong>: This is the name of the method.</li><li><strong>&#8216;<code>(int a, int b)</code>&#8216;</strong>: These are the parameters that the method accepts. In this case, the method accepts two integers called <strong>&#8216;<code>a</code>&#8216;</strong> and <strong>&#8216;<code>b</code>&#8216;</strong>.</li><li><strong>&#8216;<code>return a + b';</code></strong>: This is the body of the method. It adds the values of <code>a</code> and <code>b</code> and returns the result.</li></ul>



<p>To call this method, you would use code like this:</p>



<pre class="wp-block-code"><code>int result = CalculateSum(2, 3);
Console.WriteLine(result); // Output: 5
</code></pre>



<p>In this example, we&#8217;re calling the &#8216;<code><strong>CalculateSum</strong></code>&#8216; method and passing in the values <code><strong>2</strong></code> and <code><strong>3</strong></code> as arguments. The method calculates the sum of these values and returns the result, which we store in the <code>result</code> variable. We then output the value of <code>result</code> to the console, which displays the result <code><strong>5</strong></code>.</p>



<h2 class="wp-block-heading"><strong>Inheritance</strong>:</h2>



<p><strong>Inheritance </strong>is a powerful feature in C# that allows you to create new classes based on existing classes. Inheritance enables you to reuse the code in a base class and extend it by adding new functionality or modifying existing behavior.</p>



<p>Here&#8217;s an example of how to use inheritance in C#:</p>



<pre class="wp-block-code"><code>// Define a base class called Animal
public class Animal
{
    // Declare a protected string field
    protected string name;

    // Define a constructor to set the name field
    public Animal(string name)
    {
        this.name = name;
    }

    // Define a virtual method called MakeSound
    public virtual void MakeSound()
    {
        Console.WriteLine("The animal makes a sound.");
    }
}

// Define a derived class called Cat that inherits from Animal
public class Cat : Animal
{
    // Define a constructor that calls the base class constructor
    public Cat(string name) : base(name)
    {
    }

    // Override the MakeSound method to make a cat-specific sound
    public override void MakeSound()
    {
        Console.WriteLine("Meow!");
    }
}
</code></pre>



<p>In the example above, we defined a base class called &#8216;<strong><code>Animal</code>&#8216; </strong>with a protected field &#8216;<code><strong>name</strong></code>&#8216;, a constructor to set the &#8216;<strong><code>name</code>&#8216; </strong>field, and a virtual method called &#8216;<code><strong>MakeSound</strong></code>&#8216;. We also defined a derived class called <code>Cat</code> that inherits from &#8216;<strong><code>Animal'</code> </strong>and overrides the &#8216;<code><strong>M</strong></code><strong><code>akeSound</code></strong>&#8216; method.</p>



<p>Here are the key parts of this example:</p>



<ul class="wp-block-list"><li><strong>&#8216;<code>public class Animal</code>&#8216;</strong>: This is the base class.</li><li><strong>&#8216;<code>protected string name</code>&#8216;:</strong> This is a protected field that stores the name of the animal.</li><li><strong>&#8216;<code>public Animal(string name)</code>&#8216;</strong>: This is a constructor that sets the &#8216;<strong><code>name'</code> </strong>field.</li><li><strong>&#8216;<code>public virtual void MakeSound()</code>&#8216;</strong>: This is a virtual method that outputs a generic sound.</li><li><strong>&#8216;<code>public class Cat: Animal</code>&#8216;:</strong> This is the derived class that inherits from &#8216;<code><strong>Animal'</strong></code>.</li><li><strong>&#8216;<code>public Cat(string name) : base(name)</code>&#8216;</strong>: This is a constructor that calls the base class constructor to set the &#8216;<strong><code>name</code>&#8216; </strong>field.</li><li><strong>&#8216;<code>public override void MakeSound()</code>&#8216;</strong>: This is a method that overrides the &#8216;<strong><code>MakeSound</code>&#8216; </strong>method of the base class to output a cat-specific sound.</li></ul>



<p>To use this inheritance hierarchy, you would create an instance of the &#8216;<strong><code>Cat</code>&#8216; </strong>class and call its &#8216;<strong><code>MakeSound'</code> </strong>method:</p>



<pre class="wp-block-code"><code>Cat cat = new Cat("Fluffy");
cat.MakeSound(); // Output: Meow!
</code></pre>



<p>In this example, we create a new &#8216;<strong><code>Cat'</code> </strong>object called &#8216;<strong><code>cat'</code> </strong>and pass in the name &#8220;Fluffy&#8221; to the constructor. We then call the &#8216;<strong><code>MakeSound'</code> </strong>method on the <code>cat</code> object, which outputs the cat-specific sound &#8220;Meow!&#8221;. Because &#8216;<strong><code>Cat</code>&#8216; </strong>inherits from &#8216;<code><strong>Animal'</strong></code>, it also has access to the &#8216;<strong><code>name</code>&#8216; </strong>field and the &#8216;<strong><code>MakeSound</code>&#8216; </strong>method of the &#8216;<strong><code>Animal'</code> </strong>class.</p>



<h2 class="wp-block-heading"><strong>Polymorphism</strong>:</h2>



<p>Polymorphism is a fundamental concept in object-oriented programming that allows you to write code that can work with objects of multiple types. In C#, polymorphism is achieved through method overriding and method overloading.</p>



<p><strong>Method Overriding:</strong> Method overriding occurs when a derived class provides a different implementation of a method that is already defined in its base class. Here&#8217;s an example of how to use method overriding to implement polymorphism in C#:</p>



<pre class="wp-block-code"><code>// Define a base class called Shape
public class Shape
{
    public virtual void Draw()
    {
        Console.WriteLine("Drawing a shape.");
    }
}

// Define a derived class called Circle that overrides the Draw method
public class Circle : Shape
{
    public override void Draw()
    {
        Console.WriteLine("Drawing a circle.");
    }
}

// Define a derived class called Rectangle that overrides the Draw method
public class Rectangle : Shape
{
    public override void Draw()
    {
        Console.WriteLine("Drawing a rectangle.");
    }
}
</code></pre>



<p>In the example above, we defined a base class called &#8216;<strong><code>Shape</code>&#8216; </strong>with a virtual &#8216;<strong><code>Draw</code>&#8216; </strong>method, and two derived classes called &#8216;<strong><code>Circle</code>&#8216; </strong>and &#8216;<strong><code>Rectangle</code>&#8216; </strong>that override the &#8216;<strong><code>Draw'</code> </strong>method.</p>



<p>Here are the key parts of this example:</p>



<ul class="wp-block-list"><li>&#8216;<code><strong>public class Shape</strong></code>&#8216;: This is the base class.</li><li>&#8216;<strong><code>public virtual void Draw()</code>&#8216;:</strong> This is a virtual method that outputs a generic message.</li><li>&#8216;<strong><code>public class Circle : Shape</code>&#8216;</strong>: This is the derived class that overrides the <code>Draw</code> method to output a circle-specific message.</li><li>&#8216;<code><strong>public override void Draw(</strong>)</code>&#8216;: This is a method that overrides the <code>Draw</code> method of the base class to output a circle-specific message.</li><li><strong>&#8216;<code>public class Rectangle' </code></strong><code>: Shape</code>: This is the derived class that overrides the <code>Draw</code> method to output a rectangle-specific message.</li><li>&#8216;<code><strong>public override void Draw()</strong></code>&#8216;: This is a method that overrides the <code>Draw</code> method of the base class to output a rectangle-specific message.</li></ul>



<p>To use polymorphism with these classes, you would create instances of the <code>Circle</code> and &#8216;<code><strong>Rectangle</strong>'</code> classes and call their &#8216;<strong><code>Draw'</code> </strong>methods:</p>



<pre class="wp-block-code"><code>Shape circle = new Circle();
Shape rectangle = new Rectangle();

circle.Draw(); // Output: Drawing a circle.
rectangle.Draw(); // Output: Drawing a rectangle.
</code></pre>



<p>In this example, we create two objects, &#8216;<strong><code>circle</code>&#8216;</strong>and &#8216;<code><strong>rectangle</strong></code>&#8216;, of the base class type &#8216;<code><strong>Shape'</strong></code>. We then instantiate &#8216;<strong><code>circle'</code> </strong>as an instance of the derived &#8216;<strong><code>Circle</code>&#8216; </strong>class, and &#8216;<strong><code>rectangle'</code> </strong>as an instance of the derived &#8216;<code><strong>Rectangle</strong>'</code> class. We call the &#8216;<strong><code>Draw'</code> </strong>method on both objects, which outputs the circle-specific and rectangle-specific messages, respectively.</p>



<p><strong>Method Overloading: </strong>Method overloading occurs when multiple methods have the same name, but different parameter types or numbers. Here&#8217;s an example of how to use method overloading to implement polymorphism in C#:</p>



<pre class="wp-block-code"><code>public class Calculator
{
    public int Add(int a, int b)
    {
        return a + b;
    }

    public double Add(double a, double b)
    {
        return a + b;
    }
}
</code></pre>



<p>In the example above, we defined a class called &#8216;<strong><code>Calculator</code></strong>&#8216; with two methods called &#8216;<code><strong>Add'</strong></code>, one that takes two integers and another that takes two doubles. These two methods have the same name but different parameter types.</p>



<p>To use polymorphism with these methods, you would call them with different parameter types:</p>



<pre class="wp-block-code"><code>Calculator calculator = new Calculator();

int result1 = calculator.Add(2, 3); // Returns 5
double result2 = calculator.Add(2.5, 3.5); // Returns 6.0
</code></pre>



<p>In this example, we create a new &#8216;<code><strong>Calculator</strong></code>&#8216; object called &#8216;<code><strong>calculator</strong></code>&#8216;. We then call the &#8216;<code><strong>Add</strong></code>&#8216;.</p>



<h2 class="wp-block-heading"><strong>Encapsulation :</strong></h2>



<p>Encapsulation is one of the fundamental concepts of object-oriented programming (OOP) in C#. It refers to the practice of bundling related data (fields) and behavior (methods) into a single unit, usually a class, and controlling access to that unit through a well-defined interface.</p>



<p>In <a href="https://learn.microsoft.com/en-us/dotnet/csharp/tour-of-csharp/" target="_blank" rel="noreferrer noopener">C#</a>, encapsulation is achieved by using access modifiers such as public, private, protected, internal, and protected internal to control the visibility and accessibility of class members, such as fields, methods, and properties.</p>



<p>By making certain members private, you can ensure that they are not accessed or modified by code outside the class, thus preventing unauthorized access or modification of internal state. Instead, access to those members is provided through public or protected methods, properties, or events.</p>



<p>Encapsulation provides several benefits, including:</p>



<ul class="wp-block-list"><li>Improved code maintainability and modularity: Encapsulation allows you to hide the implementation details of a class from other parts of the program, making it easier to modify or update the class without affecting the rest of the program.</li><li>Improved code readability and understanding: Encapsulation provides a clear and concise interface for interacting with a class, making it easier to read and understand the purpose and behavior of the class.</li><li>Improved code reusability: Encapsulation allows you to reuse code by creating objects from classes that have well-defined interfaces and encapsulated state.</li></ul>



<p>Here is an example of encapsulation in C#:</p>



<pre class="wp-block-code"><code>public class Employee
{
    private string name;
    private int age;

    public Employee(string name, int age)
    {
        this.name = name;
        this.age = age;
    }

    public string GetName()
    {
        return name;
    }

    public int GetAge()
    {
        return age;
    }

    public void SetName(string name)
    {
        this.name = name;
    }

    public void SetAge(int age)
    {
        this.age = age;
    }
}
</code></pre>



<p>In this example, we have defined a class &#8216;<strong><code>Employee</code>&#8216;</strong>with private fields &#8216;<strong><code>name</code>&#8216;</strong>and &#8216;<code><strong>age'</strong></code>. We have provided public getter and setter methods for these fields using the <code><strong>'GetName'</strong></code>, &#8216;<code><strong>GetAge'</strong></code>, &#8216;<code><strong>SetName'</strong></code>, and &#8216;<code><strong>SetAge</strong>'</code> methods. By making the fields private and providing public access to them through the getter and setter methods, we have encapsulated the internal state of the &#8216;<strong><code>Employee</code> &#8216;</strong>class and provided a well-defined interface for interacting with it.</p>



<p>A class serves as a blueprint for defining user-defined data types in programming. It allows for grouping of similar objects and encapsulating their data and functionality. Objects, on the other hand, are runtime entities created from a class to access its members.</p>



<p>To create a new class, the &#8220;class&#8221; keyword is used, followed by the name of the class. Optional modifiers or attributes can be specified for the class. The members of the class, including data and functionality, are declared within curly braces &#8220;{}&#8221;. This declaration establishes the structure and behaviour of objects that will be created based on the class. So, a class declaration in programming typically starts with the &#8220;class&#8221; keyword, followed by the class name and curly braces to enclose its members. This allows for defining custom data types and their associated behaviours. Then, objects can be instantiated from the class to represent specific instances of the defined data type, with access to the members (data and functionality) defined in the class. In this way, C# classes and objects provide a way to model real-world entities and their behaviours in software development.</p>



<p></p>
<p>The post <a href="https://www.dotnetguide.com/csharp-classes-and-objects/">C# Classes and Objects</a> appeared first on <a href="https://www.dotnetguide.com">Dot Net Guide</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dotnetguide.com/csharp-classes-and-objects/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>C# Data Types And Variables with examples</title>
		<link>https://www.dotnetguide.com/csharp-data-types-and-variables-with-examples/</link>
					<comments>https://www.dotnetguide.com/csharp-data-types-and-variables-with-examples/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 30 Mar 2023 03:22:23 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[C data types and variables]]></category>
		<category><![CDATA[C# Data type]]></category>
		<category><![CDATA[C# Data types]]></category>
		<category><![CDATA[C# data types & variables]]></category>
		<category><![CDATA[C# Data types and variables]]></category>
		<category><![CDATA[data types & variables in C#]]></category>
		<category><![CDATA[data types in C]]></category>
		<category><![CDATA[data types in C#]]></category>
		<category><![CDATA[how to declare variable in C#]]></category>
		<category><![CDATA[string variable in C#]]></category>
		<category><![CDATA[variables in C#]]></category>
		<guid isPermaLink="false">https://www.dotnetguide.com/?p=1099</guid>

					<description><![CDATA[<p>In this tutorial we will learn C# Data Types And Variables. We can also Learn how to Define, Initialize and Declare a Variable Along with Various Data Types in C#. We discussed about C# Program Structure and Basic Program in our previous tutorial. For easy understanding, in this C# tutorial will learn all about C# ... </p>
<p class="read-more-container"><a title="C# Data Types And Variables with examples" class="read-more button" href="https://www.dotnetguide.com/csharp-data-types-and-variables-with-examples/#more-1099">Read more<span class="screen-reader-text">C# Data Types And Variables with examples</span></a></p>
<p>The post <a href="https://www.dotnetguide.com/csharp-data-types-and-variables-with-examples/">C# Data Types And Variables with examples</a> appeared first on <a href="https://www.dotnetguide.com">Dot Net Guide</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p><em><strong>In this tutorial we will learn C# Data Types And Variables. We can also Learn how to Define, Initialize and Declare a Variable Along with Various Data Types in C#</strong></em>.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="626" height="324" src="https://www.dotnetguide.com/wp-content/uploads/2023/03/c-DATA-TYPES-AND-VARIABLES.png" alt="C# DATA TYPES AND VARIABLES" class="wp-image-1151" srcset="https://www.dotnetguide.com/wp-content/uploads/2023/03/c-DATA-TYPES-AND-VARIABLES.png 626w, https://www.dotnetguide.com/wp-content/uploads/2023/03/c-DATA-TYPES-AND-VARIABLES-300x155.png 300w" sizes="(max-width: 626px) 100vw, 626px" /></figure>



<p>We discussed about <a href="https://www.dotnetguide.com/csharp-program-structure-and-syntax/" target="_blank" rel="noreferrer noopener">C# Program Structure and Basic Program </a>in our previous tutorial.</p>



<p><strong>For easy understanding, in this C# tutorial will learn all about C# Data Types And Variables with simple examples.</strong></p>



<p>C# is a strongly typed language, which means that every variable and expression has a specific data type that determines the range of values it can hold and the operations that can be performed on it.</p>



<p>Some common data types in C# include:</p>



<p><strong>1.int</strong> &#8211;  In C#, the integer data type is represented by the keyword <code>int</code>. It is a 32-bit signed integer and can hold values ranging from -2,147,483,648 to 2,147,483,647. Here&#8217;s an example of declaring and using an <code>int</code> variable in C#:</p>



<pre class="wp-block-code"><code>int myNumber = 42;
Console.WriteLine("My favorite number is " + myNumber);
</code></pre>



<p>In this example, we declare an <code>int</code> variable called <code>myNumber</code> and assign it the value of 42. We then use the <code>Console.WriteLine()</code> method to print a message to the console that includes the value of <code>myNumber</code>.</p>



<p><strong>2. double</strong> &#8211; In C#, the &#8216;<code><strong>double</strong></code>&#8216; data type is used to represent double-precision floating-point numbers. It occupies 8 bytes of memory and can store a wide range of values with high precision.</p>



<p>Here&#8217;s an example of using <code>double</code> in C#:</p>



<p>double x = 3.14159;</p>



<pre class="wp-block-code"><code>double x = 3.14159; // declare a double variable and initialize it with a value

double y = x * 2; // perform a mathematical operation on the double variable

Console.WriteLine("x = {0}", x); // output the value of x to the console

Console.WriteLine("y = {0}", y); // output the value of y to the console
</code></pre>



<p>In this example, we declare a double variable <code>x</code> and initialize it with the value of 3.14159. We then perform a mathematical operation on <code>x</code> by multiplying it by 2 and store the result in another double variable <code>y</code>. Finally, we output the values of <code>x</code> and <code>y</code> to the console using the <code>Console.WriteLine</code> method.</p>



<p>The output of this program would be:</p>



<pre class="wp-block-code"><code>x = 3.14159
y = 6.28318
</code></pre>



<p>As you can see, the <code>double</code> data type is useful when you need to store floating-point values with a high degree of precision.</p>



<p><strong>3. bool </strong>&#8211; used for boolean values (true or false)</p>



<pre class="wp-block-code"><code>bool isTrue = true;
bool isFalse = false;

if (isTrue)
{
    Console.WriteLine("The value of isTrue is true.");
}
else
{
    Console.WriteLine("The value of isTrue is false.");
}

if (isFalse)
{
    Console.WriteLine("The value of isFalse is true.");
}
else
{
    Console.WriteLine("The value of isFalse is false.");
}
</code></pre>



<p>In this example, we declare two boolean variables named <code>isTrue</code> and <code>isFalse</code>. The first variable is initialized with the value <code>true</code>, and the second variable is initialized with the value <code>false</code>.</p>



<p>We then use an <code>if</code> statement to check the value of each variable. The first <code>if</code> statement checks whether <code>isTrue</code> is true, and it prints a message indicating that the value of <code>isTrue</code> is true. The second <code>if</code> statement checks whether <code>isFalse</code> is true, and it prints a message indicating that the value of <code>isFalse</code> is false.</p>



<p>When we run this code, the output will be:</p>



<pre class="wp-block-code"><code>The value of isTrue is true.char myChar = 'A';
Console.WriteLine(myChar); // Output: A

The value of isFalse is false.
</code></pre>



<p><strong>4.char &#8211;</strong>In C#, the &#8216;<code><strong>char</strong></code>&#8216; data type represents a single Unicode character. It is a 16-bit value that can hold any character in the Unicode character set.</p>



<p>Here&#8217;s an example of how to use the <code>char</code> data type in C#:</p>



<pre class="wp-block-code"><code>char myChar = 'A';
Console.WriteLine(myChar); // Output: A
</code></pre>



<p>In this example, we declare a variable <code>myChar</code> of type <code>char</code> and initialize it with the character &#8216;A&#8217;. We then use the <code>Console.WriteLine()</code> method to print the value of <code>myChar</code> to the console.</p>



<p>The <code>char</code> data type can also be used to represent escape sequences, which are special characters that have a specific meaning in C#. Here&#8217;s an example:</p>



<pre class="wp-block-code"><code>char myChar = '\n';
Console.WriteLine("Hello{0}World!", myChar); // Output: 
                                             // Hello
                                             // World!
</code></pre>



<p>In this example, we assign the escape sequence &#8216;\n&#8217; to the <code>myChar</code> variable, which represents a newline character. We then use the <code>Console.WriteLine()</code> method to print the string &#8220;Hello&#8221; followed by the value of <code>myChar</code>, which causes the console to print a newline before printing the string &#8220;World!&#8221;.</p>



<p><strong>5. string</strong> &#8211; In<a href="https://learn.microsoft.com/en-us/dotnet/csharp/" target="_blank" rel="noreferrer noopener"> C#,</a> a &#8216;<strong>string</strong>&#8216; is a sequence of Unicode characters. The string data type is used to represent text values, such as names, addresses, and messages. Here&#8217;s an example of how to declare and use a string variable in C#:</p>



<pre class="wp-block-code"><code>string message = "Hello, World!";
Console.WriteLine(message);
</code></pre>



<p>In this example, we declare a string variable called &#8220;message&#8221; and assign it the value &#8220;Hello, World!&#8221;. We then use the Console.WriteLine() method to output the value of the string to the console.</p>



<p>Strings can also be concatenated using the &#8220;+&#8221; operator:</p>



<pre class="wp-block-code"><code>string name = "John";
string message = "Hello, " + name + "!";
Console.WriteLine(message);
</code></pre>



<p>In this example, we concatenate the string &#8220;Hello, &#8221; with the variable &#8220;name&#8221; and the string &#8220;!&#8221; to create the message &#8220;Hello, John!&#8221;. We then use the Console.WriteLine() method to output the value of the message to the console.</p>



<p><strong>6. decimal</strong> &#8211;  </p>



<p>In C#, the &#8216;<code><strong>decimal</strong></code>&#8216; data type is used to represent numbers with high precision, such as financial or monetary values, where accuracy is crucial.</p>



<p>Here&#8217;s an example of using <code>decimal</code> in C#:</p>



<pre class="wp-block-code"><code>decimal price = 12.99m;
decimal taxRate = 0.07m;
decimal totalPrice = price + (price * taxRate);

Console.WriteLine("Price: " + price);
Console.WriteLine("Tax Rate: " + taxRate);
Console.WriteLine("Total Price: " + totalPrice);
</code></pre>



<p>In the above example, we declare three variables of type <code>decimal</code>. We assign <code>12.99m</code> to <code>price</code> and <code>0.07m</code> to <code>taxRate</code>. We then calculate the <code>totalPrice</code> by adding the price and the tax amount (calculated as <code>price * taxRate</code>). Finally, we output the values of all three variables using <code>Console.WriteLine()</code>.</p>



<p>Note that we append the <code>m</code> character to the end of the decimal values to indicate to the C# compiler that these are <code>decimal</code> literals, and not <code>double</code> or <code>float</code> literals.</p>



<p><strong>7. float </strong>&#8211; In C#, the data type &#8220;<strong>float</strong>&#8221; is used to represent single-precision floating-point numbers. It occupies 4 bytes of memory and has a range of approximately ±1.5 x 10^-45 to ±3.4 x 10^38.</p>



<pre class="wp-block-code"><code>float myFloat = 3.14f;
Console.WriteLine(myFloat);
</code></pre>



<p>In this example, we declare a variable called &#8220;myFloat&#8221; of type &#8220;float&#8221; and assign it the value of 3.14. Note that we need to include the &#8220;f&#8221; suffix at the end of the value to indicate that it is a float literal.</p>



<p>We then use the &#8220;Console.WriteLine()&#8221; method to print out the value of &#8220;myFloat&#8221; to the console. The output would be:</p>



<pre class="wp-block-preformatted">3.14
</pre>



<p>Note that the precision of a &#8220;float&#8221; value is limited, which can result in rounding errors when performing calculations with very small or very large numbers. If you require higher precision, you may want to consider using the &#8220;double&#8221; data type instead.</p>



<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow">
<figure class="wp-block-table is-style-stripes"><table><tbody><tr><td><strong>Data Type</strong></td><td><strong>Data Size</strong></td><td class="has-text-align-left" data-align="left"><strong>Description</strong></td></tr><tr><td>char</td><td>2 bytes</td><td class="has-text-align-left" data-align="left">Stores <strong>single </strong>character quoted in single quote.</td></tr><tr><td>bool</td><td>1 bit</td><td class="has-text-align-left" data-align="left">Stores <strong>True </strong>and False <strong>value</strong></td></tr><tr><td>int</td><td>4 bytes</td><td class="has-text-align-left" data-align="left">Stores whole number from <strong>-2,147,483,648</strong> to <strong>2,147,483,647</strong></td></tr><tr><td>string</td><td>2 bytes per character</td><td class="has-text-align-left" data-align="left">Stores <strong>Sequence of characters</strong> quoted in double quote.</td></tr><tr><td>float</td><td><br>4 bytes</td><td class="has-text-align-left" data-align="left">Stores fractional numbers. Sufficient for storing <strong>6 to 7</strong> decimal digits</td></tr><tr><td>Double</td><td>8 bytes</td><td class="has-text-align-left" data-align="left">Stores fractional numbers. Sufficient for storing <strong>15</strong> decimal digits</td></tr><tr><td>long</td><td>8 bytes</td><td class="has-text-align-left" data-align="left">Stores whole numbers from <strong>-9,223,372,036,854,775,808</strong> to <strong>9,223,372,036,854,775,807</strong></td></tr><tr><td>uint</td><td>4 bytes</td><td class="has-text-align-left" data-align="left">Stores unsigned integer value from <br><strong>0</strong> to<strong> 4,294,967,295</strong></td></tr><tr><td>short</td><td>2 bytes</td><td class="has-text-align-left" data-align="left">Stores signed integer value <strong>-32,768</strong> to <strong>32,767</strong></td></tr><tr><td>ulong</td><td>8 bytes</td><td class="has-text-align-left" data-align="left">Stores  unsigned integer number from <br><strong>0</strong> to <strong>18,446,744,073,709,551,615</strong></td></tr></tbody></table></figure>
</div></div>



<h2 class="wp-block-heading">Classification Of Data Types</h2>



<p>The preceding section classifies data types based on the type of value they can hold and the amount of memory they consume. Additionally, data types can be broadly categorised into below two groups depending on how their values are stored in memory.</p>



<ul class="wp-block-list"><li>Reference Type</li><li>Value Type</li></ul>



<h3 class="wp-block-heading">1) Reference Type</h3>



<p>Reference types do not store values directly. Instead, they store the address where the value may be located. In simpler terms, a variable of a reference type simply holds a reference to a specific memory location that could contain the necessary data.</p>



<p>Reference types encompass data such as strings, arrays, and classes, among others. When changes are made to the data, other variables referencing that data will automatically reflect the updated value. If a reference type variable is not assigned a value, it will contain a null value by default.</p>



<p>There are total three different reference type:</p>



<ol class="wp-block-list"><li>Object Type: The object type is the base class for all objects in C#. It can hold any type of value, including value types, user-defined types, and reference types. For example:</li></ol>



<pre class="wp-block-code"><code>object obj = 10; //assigning an int value to an object type variable</code></pre>



<ol class="wp-block-list" start="2"><li>Dynamic Type: The dynamic type can hold any type of value, and the type check is done at runtime instead of compile-time. This means that the variable can be assigned values of different types during runtime. For example:</li></ol>



<pre class="wp-block-code"><code>dynamic dyn = 123; //assigning an int value to a dynamic type variable
dyn = "hello world"; //assigning a string value to the same variable during runtime</code></pre>



<ol class="wp-block-list" start="3"><li>String Type: The string type is used to hold a series of character values and is represented by the System.String class. It is one of the most widely used data types in C#. For example:</li></ol>



<pre class="wp-block-code"><code>string str = "hello world"; //assigning a string value to a string type variable</code></pre>



<h3 class="wp-block-heading">2) Value Type</h3>



<p>Value type data types are variables that store a data value within their own designated memory space. Therefore, these data types hold their values directly.</p>



<figure class="wp-block-table"><table><tbody><tr><td><code>int</code> <code>i = 20;</code></td></tr></tbody></table></figure>



<p>Here the integer variable “i” is directly holding the value of 20.</p>



<h2 class="wp-block-heading"><strong>C# DATA TYPES AND VARIABLES</strong></h2>



<p>In addition to these basic data types, C# also supports more complex data types such as arrays, classes, and structs.</p>



<h2 class="coblocks-animate wp-block-heading" data-coblocks-animation="clipHorizontal"><strong>C# Type Casting-Explicit and Implicit Conversion with example</strong></h2>



<p>In C#, type casting is the process of converting a value of one data type to another data type. Type casting is important when you want to perform operations on variables that are of different data types. There are two types of type casting in C#: implicit type casting and explicit type casting.</p>



<p><strong>Implicit Type Casting:</strong></p>



<p>Implicit type casting occurs when a smaller data type is converted to a larger data type. The compiler automatically performs this conversion without requiring any explicit conversion statements. For example:</p>



<pre class="wp-block-code"><code>int i = 10;
double d = i; //implicit conversion from int to double
</code></pre>



<p>In the above example, the value of <code>i</code> is implicitly converted to <code>double</code> because <code>double</code> can hold larger values than <code>int</code>.</p>



<p>Another example of implicit type casting is when you assign a literal value to a variable of a different data type, as shown below:</p>



<pre class="wp-block-code"><code>int i = 10;
long l = 1000;
float f = 1.23f;
</code></pre>



<p>Here, the values of <code>10</code>, <code>1000</code>, and <code>1.23f</code> are implicitly converted to <code>int</code>, <code>long</code>, and <code>float</code>, respectively.</p>



<p><strong>Explicit Type Casting:</strong></p>



<p>Explicit type casting occurs when a larger data type is converted to a smaller data type. In this case, you must use a cast operator to perform the conversion. For example:</p>



<pre class="wp-block-code"><code>double d = 10.5;
int i = (int)d; //explicit conversion from double to int
</code></pre>



<p>In the above example, the value of <code>d</code> is explicitly converted to <code>int</code> using the cast operator <code>(int)</code>.</p>



<p>Another example of explicit type casting is when you convert a variable of one data type to another data type using a cast operator. For example:</p>



<pre class="wp-block-code"><code>int i = 10;
long l = (long)i; //explicit conversion from int to long
</code></pre>



<p>Here, the value of <code>i</code> is explicitly converted to <code>long</code> using the cast operator <code>(long)</code>.</p>



<p>It is important to note that explicit type casting can lead to loss of data if the value of the source data type is greater than the maximum value that can be held by the target data type. In such cases, the value is truncated or rounded off.</p>



<p>In summary, implicit type casting occurs when a smaller data type is converted to a larger data type, while explicit type casting occurs when a larger data type is converted to a smaller data type. Here are some examples of both types of type casting:</p>



<pre class="wp-block-code"><code>//Implicit type casting examples
int i = 10;
double d = i; //i is implicitly converted to double

float f = 1.23f;
double d = f; //f is implicitly converted to double

//Explicit type casting examples
double d = 10.5;
int i = (int)d; //d is explicitly converted to int

float f = 1.23f;
int i = (int)f; //f is explicitly converted to int
</code></pre>



<h3 class="wp-block-heading"><strong>InvalidCastException</strong></h3>



<p>Sometimes it is possible that the compiler may not understand whether the operation performed to convert one type into another is valid or not. This causes the compiler to fail during the runtime. Once the type conversion fails, it will throw an Invalid exception.</p>



<p><strong>InvalidCastException</strong> is thrown whenever an explicit or type conversion implementation is not supported by both the data types used for conversion.</p>



<p>In this tutorial, we learned about C# Variables and Data Types. We learned to define a variable and also discussed how to declare and initialize a variable. We saw the various data types that can be used to declare a variable.</p>



<p>Every data type in C# has its own set of ranges inside which the value is declared and has a default value stored. We also learned that, how we can convert one data type to another data type by using Implicit and Explicit conversion.</p>
<p>The post <a href="https://www.dotnetguide.com/csharp-data-types-and-variables-with-examples/">C# Data Types And Variables with examples</a> appeared first on <a href="https://www.dotnetguide.com">Dot Net Guide</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dotnetguide.com/csharp-data-types-and-variables-with-examples/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>C# Program structure and Basic Syntax</title>
		<link>https://www.dotnetguide.com/csharp-program-structure-and-syntax/</link>
					<comments>https://www.dotnetguide.com/csharp-program-structure-and-syntax/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 11 Mar 2023 14:13:46 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[basic syntax in C#]]></category>
		<category><![CDATA[C# basic syntax]]></category>
		<category><![CDATA[C# Program structure]]></category>
		<category><![CDATA[Program structure in C#]]></category>
		<guid isPermaLink="false">https://www.dotnetguide.com/?p=1064</guid>

					<description><![CDATA[<p>This article Explains C# Program Structure And Basic Syntax. We will Learn the Declaration and usages of Various Components of a C# Program. C# is a popular programming language developed by Microsoft for building Windows applications, web applications, games, and more. C# Program Structure A typical C# Program consists of different parts as shown below: ... </p>
<p class="read-more-container"><a title="C# Program structure and Basic Syntax" class="read-more button" href="https://www.dotnetguide.com/csharp-program-structure-and-syntax/#more-1064">Read more<span class="screen-reader-text">C# Program structure and Basic Syntax</span></a></p>
<p>The post <a href="https://www.dotnetguide.com/csharp-program-structure-and-syntax/">C# Program structure and Basic Syntax</a> appeared first on <a href="https://www.dotnetguide.com">Dot Net Guide</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p><em><strong>This article Explains <a href="https://learn.microsoft.com/en-us/dotnet/csharp/" target="_blank" rel="noreferrer noopener">C#</a> Program Structure And Basic Syntax. We will Learn the Declaration and usages of Various Components of a C# Program.</strong></em></p>



<figure class="wp-block-image size-full"><a href="https://www.dotnetguide.com/csharp-program-structure-and-syntax/"><img decoding="async" width="626" height="324" src="https://www.dotnetguide.com/wp-content/uploads/2023/03/C-Program-structure-and-Basic-Syntax.png" alt="C# Program structure and Basic Syntax" class="wp-image-1096" srcset="https://www.dotnetguide.com/wp-content/uploads/2023/03/C-Program-structure-and-Basic-Syntax.png 626w, https://www.dotnetguide.com/wp-content/uploads/2023/03/C-Program-structure-and-Basic-Syntax-300x155.png 300w" sizes="(max-width: 626px) 100vw, 626px" /></a></figure>



<p>C# is a popular <a href="https://www.dotnetguide.com/introduction-to-dot-net-framework/" target="_blank" rel="noreferrer noopener">prog</a><a href="https://www.dotnetguide.com/introduction-to-dot-net-framework/">ramming language</a> developed by Microsoft for building Windows applications, web applications, games, and more. </p>



<h2 class="wp-block-heading"><strong>C# Program Structure</strong></h2>



<p><strong>A typical C# Program consists of different parts as shown below:</strong></p>



<ul class="wp-block-list"><li>Namespace</li><li>Class</li><li>The main method</li><li>Methods inside the class</li><li>Class attributes or definition</li><li>Statements</li><li>Comments</li></ul>



<p><strong>Here is an overview of the basic syntax and structure of a C# program:</strong></p>



<p>1. C# is case-sensitive, meaning that uppercase and lowercase letters are considered different. For example, &#8220;Hello&#8221; and &#8220;hello&#8221; are two different identifiers.</p>



<p>2. C# programs begin with the Main method, which is the entry point of the program. The Main method has the following syntax:</p>



<pre class="wp-block-code"><code>static void Main(string&#91;] args)
{
    // Code to be executed
}
</code></pre>



<p>3. C# uses semicolons (;) to mark the end of statements.</p>



<p>4. C# uses curly braces ({}) to define code blocks. A code block is a group of statements that are executed together. For example:</p>



<pre class="wp-block-code"><code>if (condition)
{
    // Code to be executed if the condition is true
}
else
{
    // Code to be executed if the condition is false
}
</code></pre>



<p>5.  C# uses double slashes (//) for single-line comments, and /* and */ for multi-line comments. Comments are ignored by the compiler and are used to add notes or explanations to the code.</p>



<p>6.  <strong>Namespace</strong>: A namespace is a grouping mechanism that organises related classes and objects. Its purpose is to prevent conflicts between different sets of objects by segregating them from each other. With namespaces, programmers can define classes in one namespace without interfering with classes in another namespace.</p>



<p>C# programs are typically organised into namespaces, which are containers for related classes and other type. The namespace declaration comes at the top of the file and looks like this:</p>



<pre class="wp-block-code"><code> namespace MyNamespace
{
    // Classes and other types go here
}
</code></pre>



<p>7. <strong>Class</strong>: In C#, a class is a blueprint for creating objects. Classes can contain fields, properties, methods, and other members that define the behaviour and properties of the objects they represent. Here is an example of a class:</p>



<pre class="wp-block-code"><code>public class MyClass
{
    private int _myField;

    public void MyMethod()
    {
        // Code goes here
    }

    public int MyProperty { get; set; }
}</code></pre>



<p>8. <strong>Statements and expressions</strong>: In C#, statements are instructions that perform some action, such as assigning a value to a variable or calling a method. Expressions, on the other hand, are combinations of values, operators, and method calls that evaluate to a single value. Here are some examples of statements and expressions:</p>



<pre class="wp-block-code"><code>int x = 10; // statement
int y = x + 5; // expression
Console.WriteLine("Hello, world!"); // statement
</code></pre>



<p>9. <strong>Control flow statements: </strong>C# includes a variety of control flow statements that allow you to control the flow of execution in your program. These include if/else statements, switch statements, loops, and more. Here are some examples:</p>



<pre class="wp-block-code"><code>if (x &gt; 10)
{
    // Code goes here
}
else
{
    // Code goes here
}

switch (x)
{
    case 1:
        // Code goes here
        break;
    case 2:
        // Code goes here
        break;
    default:
        // Code goes here
        break;
}

while (x &gt; 0)
{
    // Code goes here
    x--;
}
</code></pre>



<p>10. <strong>Variables</strong>: Variables are used to store data in a C# program. C# supports several types of variables, including integers, floating-point numbers, strings, and boolean. Variables are declared using the var keyword.</p>



<pre class="wp-block-code"><code>int myInt = 42;
float myFloat = 3.14f;
string myString = "Hello, world!";
bool myBoolean = true;
</code></pre>



<p>11. <strong>Operators</strong>: Operators are used to perform operations on variables in a C# program. C# supports several types of operators, including arithmetic operators (+, -, *, /), comparison operators (==, !=, &lt;, &gt;), and logical operators (&amp;&amp;, ||).</p>



<pre class="wp-block-code"><code>int x = 10;
int y = 20;
int z = x + y; // z is now 30
bool b = (x &lt; y) &amp;&amp; (y &lt; z); // b is true
</code></pre>



<p><strong>Access Modifiers: </strong></p>



<p>Access modifiers define the accessibility of an object and its components. All the C# components have their own access level that can be controlled by defining the scope of accessibility for the member objects inside the class by using access modifiers.</p>



<p>To define the accessibility level of the object we have to declare it by using one of the keywords provided by C# language i.e. Public, Private, Protected and Internal. Access modifier is declared by using either of the keywords mentioned above before the class or a method.</p>



<ul class="wp-block-list"><li><strong>Public</strong>: Members with the public access modifier are accessible from anywhere in the application, both inside and outside of the class or struct.                                  Example:</li></ul>



<pre class="wp-block-code"><code>public class ExampleClass
{
    public int publicField = 10;
    public void PublicMethod()
    {
        // Method code here
    }
}
</code></pre>



<ul class="wp-block-list" start="2"><li><strong>Private</strong>: Members with the private access modifier are only accessible within the same class or struct.</li></ul>



<p>Example:</p>



<pre class="wp-block-code"><code>public class ExampleClass
{
    private int privateField = 10;
    private void PrivateMethod()
    {
        // Method code here
    }
}
</code></pre>



<ul class="wp-block-list" start="3"><li><strong>Protected</strong>: Members with the protected access modifier are accessible within the same class or struct, and any derived classes.</li></ul>



<p>Example:</p>



<pre class="wp-block-code"><code>public class BaseClass
{
    protected int protectedField = 10;
    protected void ProtectedMethod()
    {
        // Method code here
    }
}

public class DerivedClass : BaseClass
{
    public void SomeMethod()
    {
        // DerivedClass can access protectedField and ProtectedMethod from BaseClass
    }
}
</code></pre>



<ul class="wp-block-list" start="4"><li><strong>Internal</strong>: Members with the internal access modifier are accessible within the same assembly (i.e., project).                                                                                           Example:</li></ul>



<pre class="wp-block-code"><code>internal class ExampleClass
{
    internal int internalField = 10;
    internal void InternalMethod()
    {
        // Method code here
    }
}
</code></pre>



<ul class="wp-block-list" start="5"><li><strong>Protected internal</strong>: Members with the protected internal access modifier are accessible within the same assembly and any derived classes, regardless of whether they are in the same assembly or not.</li></ul>



<p>Example:</p>



<pre class="wp-block-code"><code>public class BaseClass
{
    protected internal int protectedInternalField = 10;
    protected internal void ProtectedInternalMethod()
    {
        // Method code here
    }
}

public class DerivedClass : BaseClass
{
    public void SomeMethod()
    {
        // DerivedClass can access protectedInternalField and ProtectedInternalMethod from BaseClass
    }
}
</code></pre>
<p>The post <a href="https://www.dotnetguide.com/csharp-program-structure-and-syntax/">C# Program structure and Basic Syntax</a> appeared first on <a href="https://www.dotnetguide.com">Dot Net Guide</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dotnetguide.com/csharp-program-structure-and-syntax/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>