<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Nick</title>
    <description>The latest articles on DEV Community by Nick (@homolibere).</description>
    <link>https://dev.to/homolibere</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1181392%2F50ad4a50-d1dc-4910-975d-76c4f5a8bb7a.jpeg</url>
      <title>DEV Community: Nick</title>
      <link>https://dev.to/homolibere</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/homolibere"/>
    <language>en</language>
    <item>
      <title>POCking AI</title>
      <dc:creator>Nick</dc:creator>
      <pubDate>Tue, 25 Nov 2025 10:37:15 +0000</pubDate>
      <link>https://dev.to/homolibere/pocking-ai-59e0</link>
      <guid>https://dev.to/homolibere/pocking-ai-59e0</guid>
      <description>&lt;p&gt;This article reflects my personal experience over 8 months of intensive AI-assisted development across multiple projects. Your mileage may vary, but the principles should translate across languages and frameworks.&lt;/p&gt;

&lt;p&gt;I was presenting this topic at Moldova DevCon 2025 and i want to share the whole story.&lt;/p&gt;

&lt;p&gt;This is my journey in pair software development with AI. This is not an advertisement or promo for any of products and any services i'm going to talk about. This is a personal opinion. I'll talk about some challenges and gains that i've encountered during these coding sessions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I Started This Journey?
&lt;/h2&gt;

&lt;p&gt;Eight months ago, I was that developer who rolled his eyes at AI coding tools. "Just fancy autocomplete," I thought. "Real developers don't need assistance." Basically, I didn't want to pay for stuff that I don't believe will be useful for me. Then we just decided to give it a try. We have PCI DSS certification, so we can't just go with any AI. We need something more or less self hosted. Nobody wants to support this kind of infrastructure, so we decided to give a go to Amazon Q Developer. At that time I had an overwhelming amount of reviews and more coming.&lt;/p&gt;

&lt;p&gt;More out of desperation than curiosity, I installed an Amazon Q Developer. Not because I believed in it, but because I was running out of time and options. What happened next wasn't magical or revolutionary - it was just... as i expected. Reviews of changes without understanding of context or domain give no result. Almost all reviews was "Looks good for me". But the ability of AI assistant to use glab console tool to get changes and that assistant understand how to use it by it owh - was impressive at least. That brought me to research or better to say learn how to use it properly. Small things at first. The AI would suggest a method name that was better than what I was about to type. It would catch a null reference before I did. It would generate test cases I hadn't thought of.&lt;/p&gt;

&lt;p&gt;But the real moment came when I get Kiro from Amazon into my hands. Spec flow approach made me excited as 8 year old on birthday. I would describe a problem, and the AI would suggest an approach. It would create a design document then I would refine the idea, and it would design technical documentation. We were actually having a conversation about code. Then, when everything looks fine - generate a step-by-step implementation list. That's when I knew something fundamental had changed in how software gets built.&lt;/p&gt;

&lt;p&gt;This is not about AI replacing developers. This is about developers and AI working together in ways that make both more effective. And yes, there are pitfalls, frustrations, and moments when you want to throw your laptop out the window. But there are also moments of genuine partnership that I never expected to experience with code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fail Fast
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Fail fast, also sometimes termed fail often or fail cheap, is a business management concept and theory of organizational psychology that argues businesses should encourage employees to use a trial-and-error process to quickly determine and assess the long-term viability of a product or strategy and move on, cutting losses rather than continuing to invest in a doomed approach. - Wikipedia.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This concept also known to developers. We try to quit from function execution as soon as result is obvious. At grooming or decomposition stage, when we just thinking how it should work and do not have practical experience, to estimate outcome of new architecture or functionality. Fail fast approach can help iterate quickly and test theories before we invest huge amount of time into it. At this point AI code assistants, especially agents with support of tools, can provide huge help.&lt;/p&gt;

&lt;p&gt;Testing a theory that we have in our mind can be quick and dirty. We do not need a clean code or onion layered architecture to get the proof of concept. We need to have it working and we need it now.&lt;/p&gt;

&lt;p&gt;Recently, I wanted to test if a new caching strategy would improve our API response times. Instead of spending days implementing a full solution, I asked the AI agent to create a quick prototype with cache integration. In 30 minutes, I had a working proof of concept that clearly showed the performance benefits. This validated the approach before committing to a full implementation.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  The Fear Of A Blank Page
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;The fear of a blank page is a common experience for many writers and artists. This anxiety often stems from the pressure to create something perfect right from the start. It can lead to procrastination and self-doubt, making it difficult to begin any creative work.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I have one. I often thinks about new pet project and what i should do and then... i just do not want to write huge amount of code just to get started. This is especially true for web projects or some kind of API hosts. I need to configure logging the way i like, metrics, health checks, authorization and authentication etc. This process makes me already tired and i don't want to do it. I've tried to use some templates, but languages and frameworks changes so fast, that this approach is not viable for me either.&lt;/p&gt;

&lt;p&gt;AI code agents can help overcome this fear or better to say, in my case, procrastination. They can create starter project with all i like and require faster. Meanwhile i'll keep thinking how i want tho do main logic of application.&lt;/p&gt;

&lt;p&gt;What used to take me 2-3 hours of boilerplate setup now takes 15-20 minutes. The AI can scaffold a complete web project with structured logging, health checks endpoints, authentication setup, containerization configuration, and basic database operations. While the AI handles the infrastructure, I can focus on the business logic that actually matters.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to Choose?
&lt;/h2&gt;

&lt;p&gt;There is a few options right now. IDE integrated agents or separate console agents. In terms of what to choose - matter of taste. I've used both and i prefer IDE integrated, because i can see what they are doing and review code during generation. While AI generating one part of project - i can review another.&lt;/p&gt;

&lt;p&gt;It's hard to find IDE that does not have AI integration of some kind. &lt;/p&gt;

&lt;p&gt;My favorite is Amazon Kiro and VS Code Copilot. I have separate window with ongoing monolog of AI agent, a window with files showing diff to me. If i spotted that things goes wrong - i can stop process, correct my prompt and restart earlier.&lt;/p&gt;

&lt;p&gt;I found that, it is a much better experience, if you use versioning tools with your project. First of all this gives you peace of mind when code generation running. You will not loose anything that was pushed to repo. Second, you can revert safely and fully then iterate again.&lt;/p&gt;

&lt;p&gt;Always work with a clean git state before starting AI sessions. Commit your working changes first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Context
&lt;/h2&gt;

&lt;p&gt;This is fight between give as much as possible and receive what you expected. When you give all you have to LLM - it has to much of freedom and does not understand how to deliver what you want. This is usual problem between software developers and product owners and/or business owner. People can not understand each other and we think that our train of thoughts can be processed be LLM as we expecting. This not a case so far. Maybe in future we will get AGI and it will do even better that promt it has, but not now. Not yet. We still need to give some context and set some boundaries.&lt;/p&gt;

&lt;p&gt;On my experience, big code base is too much for an agent for now. I can not get meaningful results from LLM on one of our monorepo project with 250K+ LOC, with custom nuget packages and dependencies. It's out of agent capabilities. But when i start a new project from scratch - i constantly get an acceptable results. Yes, i still have to polish it, but it is usable.&lt;/p&gt;

&lt;p&gt;So, modern AI agents support rule sets to provide some constrains. This is very useful to keep DRY principle.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Context Strategy:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Small focused sessions&lt;/strong&gt;: Work on one feature/component at a time&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Clear boundaries&lt;/strong&gt;: Define what files/folders the AI should focus on&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Progressive disclosure&lt;/strong&gt;: Start with high-level architecture, then drill down&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rule sets help&lt;/strong&gt;: Use modern language features, follow established patterns, include documentation, use validation libraries, follow company naming conventions&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  When AI Gets It Wrong: Debugging Together
&lt;/h2&gt;

&lt;p&gt;AI isn't perfect. It makes mistakes, especially with complex business logic, framework-specific edge cases, security considerations, and performance optimizations.&lt;/p&gt;

&lt;p&gt;AI generated a database query that looked correct but had performance issues. It was fetching data in a loop instead of using proper joins, creating multiple database calls when one would suffice. After explaining the performance problem, AI corrected the approach to use a single optimized query with proper relationships included.&lt;/p&gt;

&lt;p&gt;This is how i usually approach debugging with AI:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Describe the unexpected behavior clearly&lt;/li&gt;
&lt;li&gt;Share error messages and stack traces&lt;/li&gt;
&lt;li&gt;Explain the expected vs. actual behavior&lt;/li&gt;
&lt;li&gt;Let AI propose solutions, then review together&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And remember, AI does not learn new things. All changes that are made during debug session should be stored somewhere. It can be a separate md file that next time you need to add to context or much better way - update general documentation about project.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Code Quality and Maintainability
&lt;/h2&gt;

&lt;p&gt;AI a very good at following rules, especially those related to code quality and maintainability. Specifying rules and guidelines helps AI generate code that is consistent, readable, and maintainable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What AI does well&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Consistent naming conventions. Following naming conventions helps to improve code readability and maintainability and agents usually do this by themselves. They trained on large codebases and many projects follows same conventions.&lt;/li&gt;
&lt;li&gt;Proper exception handling patterns. But sometimes they over-engineer solutions, leading to unnecessary complexity. Creating custom exception even if it's not necessary. This can lead to confusion and unnecessary complexity.&lt;/li&gt;
&lt;li&gt;Comprehensive documentation. AI does great at writing documentation on existing code, especially if this code was written by AI during the same session.&lt;/li&gt;
&lt;li&gt;Following established patterns in the codebase. If you provide examples how to do it, AI will follow them religiously. This is very useful if you have some specific preferences in file location, tests arrangement and other rules.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What needs human review&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Business logic correctness. This is an "Achilles' heel" of AI-generated code. While AI can generate code that follows patterns and conventions, it may not always understand the business logic correctly.&lt;/li&gt;
&lt;li&gt;Security implications. Generated code may not always be secure. Some times it may be vulnerable to common attacks.&lt;/li&gt;
&lt;li&gt;Performance considerations. Nova days many developers does not think about performance optimization. It's easier to add more memory and CPU resources than to optimize code. LLM's usually have a hard time with this also.&lt;/li&gt;
&lt;li&gt;Architectural decisions. Decide when to use what pattern or how to structure dependencies is a very hard task for AI. It's better to let humans make these decisions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Testing and AI: A Complex Relationship
&lt;/h2&gt;

&lt;p&gt;AI excels at generating unit tests but struggles with integration testing nuances. Mocking classes and services is no brainer for AI, but integration testing requires understanding of the system's architecture and dependencies. AI can help with setting up mocks and stubs, but it's important to ensure that the tests cover all possible scenarios and edge cases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Strengths:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Comprehensive test coverage for public methods&lt;/li&gt;
&lt;li&gt;Edge case identification&lt;/li&gt;
&lt;li&gt;Mock setup and teardown&lt;/li&gt;
&lt;li&gt;Test data generation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;AI generated test follows standard patterns with proper arrangement, action, and assertion phases. It includes validation for edge cases like invalid inputs and expected exception handling. The test structure is clean and follows naming conventions consistently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Limitations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Doesn't understand complex business workflows&lt;/li&gt;
&lt;li&gt;Struggles with database integration tests&lt;/li&gt;
&lt;li&gt;Can't validate UI behavior&lt;/li&gt;
&lt;li&gt;integration tests are difficult for AI to generate&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Economics of AI Development
&lt;/h2&gt;

&lt;p&gt;Let's talk about the elephant in the room: the cost. When you hear "AI," you might think of massive, expensive infrastructure projects. The reality of AI-assisted development is far more down-to-earth. For an individual developer or a small team, the monthly subscription for a top-tier AI assistant is often less than the cost of a few hours of a developer's time. When you factor in the productivity gains—less time spent on boilerplate, faster debugging, and quicker prototyping—the return on investment becomes obvious very quickly. It's not an extravagant expense; it's a force multiplier.&lt;/p&gt;

&lt;p&gt;However, the real cost isn't always measured in money. The biggest concern, and a valid one, is data security. Sending your proprietary source code to a third-party server is a non-starter for any organization with serious security or compliance obligations, like the PCI DSS certification we have. This is where you need to be selective. You can't just use any free or consumer-grade tool. The solution is to opt for enterprise-grade services like GitHub Copilot for Business or Amazon Q Developer, which offer commitments around data privacy, ensuring your code isn't used for training their public models and is kept confidential. The cost is slightly higher, but it's the necessary price for secure and responsible AI adoption.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Team Dynamics: Introducing AI to Your Development Process
&lt;/h2&gt;

&lt;p&gt;Bringing an AI assistant into a development team isn't just a technical change; it's a cultural one. You can't just send out a memo and expect everyone to embrace it. Here’s how to do it right:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Start with a Pilot Group&lt;/strong&gt;: Find a few enthusiastic developers who are open to experimenting. Let them be the pioneers. Their successes and learnings will become the best internal marketing you could ask for.&lt;br&gt;
&lt;strong&gt;Establish Clear Guidelines&lt;/strong&gt;: Don't let it be a free-for-all. Create a simple "How-To" guide: how to write effective prompts, what tasks it's best for (and what it's bad at), and most importantly, what not to share with the AI (e.g., API keys, customer data, security vulnerabilities).&lt;br&gt;
&lt;strong&gt;Reframe it as Pair Programming&lt;/strong&gt;: Encourage the team to think of the AI as a junior pair programmer. It’s fast and knows the syntax, but it lacks domain context and needs senior oversight. This framing helps manage expectations and reduces the fear of replacement.&lt;br&gt;
&lt;strong&gt;Evolve Your Code Reviews&lt;/strong&gt;: AI-generated code still needs human review. The focus of code reviews will shift from catching syntax errors to validating business logic, architectural alignment, and potential security holes. The question is no longer "Does it work?" but "Is it the right solution?"&lt;br&gt;
&lt;strong&gt;Create a Feedback Loop&lt;/strong&gt;: Set up a dedicated chat channel where team members can share wins, funny failures, and effective prompts. This builds a collaborative learning culture and helps everyone get better at using the tool together.&lt;br&gt;
&lt;strong&gt;Address the fear head-on&lt;/strong&gt;: AI isn't here to take jobs, it's here to take away the tedious, repetitive parts of the job, freeing up developers to focus on the complex, creative problem-solving that humans do best.&lt;/p&gt;

&lt;h2&gt;
  
  
  Actionable Takeaways
&lt;/h2&gt;

&lt;p&gt;If you're going to start your own journey with an AI coding partner, here are the key takeaways from my experience:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Start with a Clean Slate&lt;/strong&gt;: Always commit your changes to version control before starting a session with an AI agent. It's your ultimate undo button and safety net.&lt;br&gt;
&lt;strong&gt;Be the Architect, Let AI Be the Builder&lt;/strong&gt;: You define the "what" and the "why." Let the AI handle the "how" for the boilerplate and routine code. Your primary role is to provide direction and review the output.&lt;br&gt;
&lt;strong&gt;Master the Art of Context&lt;/strong&gt;: Don't dump your entire codebase on the AI. Give it focused, relevant information for the task at hand. Treat it like a junior developer you're onboarding to a specific feature.&lt;br&gt;
&lt;strong&gt;Trust No One&lt;/strong&gt;: AI makes mistakes. Your expertise is the final quality gate. Review every significant piece of generated code for correctness, security, and performance.&lt;br&gt;
&lt;strong&gt;Use AI to "Fail Faster"&lt;/strong&gt;: Got a new idea? Use the AI to build a quick and dirty proof-of-concept. You can validate an approach in minutes or hours, not days.&lt;br&gt;
&lt;strong&gt;Document Your Debugging Sessions&lt;/strong&gt;: When you and the AI solve a problem, update your project's documentation. This becomes part of the context for future sessions, effectively "teaching" the AI your project's nuances.&lt;br&gt;
&lt;strong&gt;Introduce It Collaboratively&lt;/strong&gt;: When bringing AI to your team, do it thoughtfully. Start small, provide guidelines, and foster a culture of shared learning.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;AI in software development isn't about replacement—it's about amplification. It amplifies your productivity, your ability to explore ideas quickly, and your capacity to handle complex projects. But it also amplifies your mistakes if you don't maintain critical thinking and code review discipline.&lt;/p&gt;

&lt;p&gt;The future belongs to developers who can effectively collaborate with AI while maintaining their core engineering skills. Start experimenting now, but remember: the goal isn't to write less code, it's to solve more problems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Advice:&lt;/strong&gt; Treat AI as the best junior developer you've ever worked with — extremely capable, incredibly fast and with amnesia. Needs guidance, context, and oversight. With that mindset, you'll build a productive partnership that enhances rather than replaces your capabilities.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
    </item>
    <item>
      <title>The Dangling If-Else Problem: A Common Pitfall in Programming</title>
      <dc:creator>Nick</dc:creator>
      <pubDate>Fri, 15 Mar 2024 09:17:02 +0000</pubDate>
      <link>https://dev.to/homolibere/the-dangling-if-else-problem-a-common-pitfall-in-programming-1i1c</link>
      <guid>https://dev.to/homolibere/the-dangling-if-else-problem-a-common-pitfall-in-programming-1i1c</guid>
      <description>&lt;p&gt;One common pitfall that programmers often fall into when working with conditional statements in C# is known as the "dangling if-else problem". This issue arises when an if-else statement is not structured properly, leading to unexpected or unintended behavior in the program.&lt;/p&gt;

&lt;p&gt;The dangling if-else problem can occur when there are multiple if-else statements nested within each other, and the conditions are not properly defined or the logic is not correctly implemented. This can result in the code executing in ways that are not intended by the programmer, leading to bugs or errors in the program.&lt;/p&gt;

&lt;p&gt;To illustrate this issue, let's take a look at a simple example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int num = 5;

if (num &amp;lt; 10)
    Console.WriteLine("Number is less than 10");
else 
    if (num &amp;lt; 5)
        Console.WriteLine("Number is less than 5");
    else
        Console.WriteLine("Number is equal to or greater than 5");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this code snippet, the intent is to print out a message based on the value of the variable &lt;code&gt;num&lt;/code&gt;. However, due to the improper nesting of the if-else statements, the program will actually print out "Number is less than 10" even if &lt;code&gt;num&lt;/code&gt; is equal to or greater than 5. This is because the second if statement (&lt;code&gt;num &amp;lt; 5&lt;/code&gt;) is nested within the else block of the first if statement, causing it to be skipped over.&lt;/p&gt;

&lt;p&gt;To avoid the dangling if-else problem, it is important to carefully structure your if-else statements and ensure that the conditions are properly defined. One way to avoid this issue is to use braces &lt;code&gt;{}&lt;/code&gt; to explicitly define the blocks of code within the if-else statements, like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int num = 5;

if (num &amp;lt; 10)
{
    Console.WriteLine("Number is less than 10");
}
else 
{
    if (num &amp;lt; 5)
    {
        Console.WriteLine("Number is less than 5");
    }
    else
    {
        Console.WriteLine("Number is equal to or greater than 5");
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By using braces to clearly define the blocks of code within each if-else statement, you can prevent the dangling if-else problem and ensure that your program behaves as expected. Remember to always test your code thoroughly and pay attention to the structure of your conditional statements to avoid running into unexpected issues.&lt;/p&gt;

</description>
      <category>csharp</category>
    </item>
    <item>
      <title>What is DateTime Manipulation in C#?</title>
      <dc:creator>Nick</dc:creator>
      <pubDate>Thu, 14 Mar 2024 10:39:09 +0000</pubDate>
      <link>https://dev.to/homolibere/what-is-datetime-manipulation-in-c-30a8</link>
      <guid>https://dev.to/homolibere/what-is-datetime-manipulation-in-c-30a8</guid>
      <description>&lt;p&gt;DateTime manipulation in C# refers to the ability to perform various operations on date and time values, such as adding or subtracting time, extracting specific components of a date, formatting dates in different ways, and comparing different dates.&lt;/p&gt;

&lt;p&gt;One of the most common tasks when working with dates and times is to manipulate them in some way. C# provides a DateTime struct that represents a specific point in time and allows us to perform various operations on dates and times.&lt;/p&gt;

&lt;p&gt;Here are some common examples of date and time manipulation in C#:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Adding or subtracting time:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;DateTime&lt;/span&gt; &lt;span class="n"&gt;currentDate&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;DateTime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Now&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;DateTime&lt;/span&gt; &lt;span class="n"&gt;futureDate&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;currentDate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddDays&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;7&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Add 7 days to the current date&lt;/span&gt;
&lt;span class="n"&gt;DateTime&lt;/span&gt; &lt;span class="n"&gt;pastDate&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;currentDate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddMonths&lt;/span&gt;&lt;span class="p"&gt;(-&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Subtract 1 month from the current date&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Extracting components of a date:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;DateTime&lt;/span&gt; &lt;span class="n"&gt;currentDate&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;DateTime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Now&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;day&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;currentDate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Day&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Get the day of the month&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;month&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;currentDate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Month&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Get the month&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;year&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;currentDate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Year&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Get the year&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Formatting dates:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;DateTime&lt;/span&gt; &lt;span class="n"&gt;currentDate&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;DateTime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Now&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;formattedDate&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;currentDate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ToString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"MM/dd/yyyy"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Format the date as "MM/dd/yyyy"&lt;/span&gt;
&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;formattedTime&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;currentDate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ToString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"hh:mm:ss tt"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Format the time as "hh:mm:ss tt"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Comparing dates:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;DateTime&lt;/span&gt; &lt;span class="n"&gt;date1&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;DateTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;2022&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;31&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;DateTime&lt;/span&gt; &lt;span class="n"&gt;date2&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;DateTime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Now&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;date1&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;date2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Date1 is before Date2"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;date1&lt;/span&gt; &lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;date2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Date1 is after Date2"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Date1 and Date2 are equal"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;DateTime manipulation is an essential skill for any C# developer working with date and time values. By understanding how to manipulate dates and times effectively, you can perform a wide range of tasks and create more dynamic and flexible applications.&lt;/p&gt;

</description>
      <category>csharp</category>
    </item>
    <item>
      <title>Understanding Implicit Usings in C#</title>
      <dc:creator>Nick</dc:creator>
      <pubDate>Wed, 13 Mar 2024 08:40:48 +0000</pubDate>
      <link>https://dev.to/homolibere/understanding-implicit-usings-in-c-11le</link>
      <guid>https://dev.to/homolibere/understanding-implicit-usings-in-c-11le</guid>
      <description>&lt;p&gt;In C#, the language has made strides in making code more concise and easier to read. One of the features that contribute to this is implicit usings. Implicit usings allow developers to skip writing using statements for commonly used namespaces, such as System.&lt;/p&gt;

&lt;p&gt;In C#, the using directive is used to import namespaces that contain classes and other types that are referenced in the code. This makes it easier to reference classes without having to write out the full namespace each time. However, with implicit usings, developers can skip the using statement altogether for certain namespaces.&lt;/p&gt;

&lt;p&gt;Here is an example of how implicit usings work in C#:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// In this code snippet, we are using the System namespace without explicitly writing a using statement&lt;/span&gt;
&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Hello, World!"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this code snippet, we are using the Console class without writing a using statement for the System namespace. This is possible because the System namespace is implicitly included in every C# file by default.&lt;/p&gt;

&lt;p&gt;Implicit usings can make code cleaner and more readable, as developers don't have to clutter their code with unnecessary using statements. However, it is important to note that implicit usings can only be used for certain namespaces that are included by default by the compiler.&lt;/p&gt;

&lt;p&gt;Overall, understanding implicit usings in C# can help developers write cleaner and more concise code. By leveraging this feature, developers can streamline their code and focus on building functionality without getting bogged down with unnecessary syntax.&lt;/p&gt;

</description>
      <category>csharp</category>
    </item>
    <item>
      <title>Creating Custom NuGet Packages in C#</title>
      <dc:creator>Nick</dc:creator>
      <pubDate>Tue, 12 Mar 2024 07:21:52 +0000</pubDate>
      <link>https://dev.to/homolibere/creating-custom-nuget-packages-in-c-n8b</link>
      <guid>https://dev.to/homolibere/creating-custom-nuget-packages-in-c-n8b</guid>
      <description>&lt;p&gt;Creating custom NuGet packages in C# can be a useful way to share reusable code with other developers, whether within your organization or in the wider community. NuGet packages are a convenient way to package and distribute code, allowing other developers to easily incorporate your code into their projects.&lt;/p&gt;

&lt;p&gt;To create a custom NuGet package in C#, first, you will need to create a class library project. This project will contain the code that you want to package into a NuGet package. Once you have created your class library project, you can add any classes, interfaces, or other code that you want to include in your NuGet package. &lt;/p&gt;

&lt;p&gt;Next, you will need to create a NuGet package specification file. This file, typically named &lt;code&gt;YourPackageName.nuspec&lt;/code&gt;, contains metadata about your package, such as its name, version, description, dependencies, and author information. You can create this file manually or use tools such as &lt;code&gt;NuGet Package Explorer&lt;/code&gt; to generate it.&lt;/p&gt;

&lt;p&gt;Here is an example of a &lt;code&gt;YourPackageName.nuspec&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?xml version="1.0"?&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;package&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;metadata&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;id&amp;gt;&lt;/span&gt;YourPackageName&lt;span class="nt"&gt;&amp;lt;/id&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;version&amp;gt;&lt;/span&gt;1.0.0&lt;span class="nt"&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;authors&amp;gt;&lt;/span&gt;Your Name&lt;span class="nt"&gt;&amp;lt;/authors&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;owners&amp;gt;&lt;/span&gt;Your Name&lt;span class="nt"&gt;&amp;lt;/owners&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;requireLicenseAcceptance&amp;gt;&lt;/span&gt;false&lt;span class="nt"&gt;&amp;lt;/requireLicenseAcceptance&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;description&amp;gt;&lt;/span&gt;Your package description&lt;span class="nt"&gt;&amp;lt;/description&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;dependencies&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;dependency&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"AnotherPackageName"&lt;/span&gt; &lt;span class="na"&gt;version=&lt;/span&gt;&lt;span class="s"&gt;"1.0.0"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/dependencies&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/metadata&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/package&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you have created your class library project and &lt;code&gt;YourPackageName.nuspec&lt;/code&gt; file, you can build your project to generate the &lt;code&gt;.nupkg&lt;/code&gt; file, which is your NuGet package. You can then publish this package to a NuGet feed, either public or private, for other developers to consume.&lt;/p&gt;

&lt;p&gt;To consume your custom NuGet package in another project, you can use the NuGet Package Manager in Visual Studio or the &lt;code&gt;dotnet&lt;/code&gt; CLI tool. Simply search for your package, select it, and install it into your project.&lt;/p&gt;

&lt;p&gt;Creating custom NuGet packages in C# can help you share your code with others, streamline development processes, and promote code reuse. Give it a try and see how it can benefit your projects!&lt;/p&gt;

</description>
      <category>csharp</category>
    </item>
    <item>
      <title>Understanding "out var _" in C#</title>
      <dc:creator>Nick</dc:creator>
      <pubDate>Mon, 11 Mar 2024 07:31:02 +0000</pubDate>
      <link>https://dev.to/homolibere/understanding-quotout-var-quot-in-c-1h6b</link>
      <guid>https://dev.to/homolibere/understanding-quotout-var-quot-in-c-1h6b</guid>
      <description>&lt;p&gt;In C#, the "out var _" syntax is a shorthand way of declaring variables when using out parameters in method calls. This can be especially useful when we are only interested in one particular out parameter and don't need to assign a name to it.&lt;/p&gt;

&lt;p&gt;Let's take a look at an example to better understand this concept:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Example&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;GetNameAndAge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;out&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;out&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"John"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="m"&gt;30&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;Main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nf"&gt;GetNameAndAge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;out&lt;/span&gt; &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;out&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;$"Name: &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we have a method called &lt;code&gt;GetNameAndAge&lt;/code&gt; that returns both a name and an age as out parameters. In the &lt;code&gt;Main&lt;/code&gt; method, we call &lt;code&gt;GetNameAndAge&lt;/code&gt; and use the "out var name, out _" syntax to only assign a value to the &lt;code&gt;name&lt;/code&gt; variable while ignoring the &lt;code&gt;age&lt;/code&gt; parameter.&lt;/p&gt;

&lt;p&gt;By using the "out var _" syntax, we can make our code more concise and readable, especially in situations where we don't need to use all of the out parameters returned by a method.&lt;/p&gt;

&lt;p&gt;Overall, understanding and using the "out var _" syntax in C# can help make our code more efficient and maintainable in certain scenarios.&lt;/p&gt;

</description>
      <category>csharp</category>
    </item>
    <item>
      <title>Nameof in C#</title>
      <dc:creator>Nick</dc:creator>
      <pubDate>Sun, 10 Mar 2024 08:31:40 +0000</pubDate>
      <link>https://dev.to/homolibere/nameof-in-c-2ip5</link>
      <guid>https://dev.to/homolibere/nameof-in-c-2ip5</guid>
      <description>&lt;p&gt;C# Nameof is a feature in C# that allows you to get the name of a variable, type, or member as a string. This can be useful for things like logging, debugging, and reflection. Let's take a look at how Nameof works with some code examples.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;System&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Example&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;DisplayPropertyName&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;propertyName&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;nameof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;propertyName&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Output: Name&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Program&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;Main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;Example&lt;/span&gt; &lt;span class="n"&gt;example&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Example&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="n"&gt;example&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;DisplayPropertyName&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

        &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;typeName&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;nameof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Example&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;typeName&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Output: Example&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above code, we have a class &lt;code&gt;Example&lt;/code&gt; with a property &lt;code&gt;Name&lt;/code&gt; and a method &lt;code&gt;DisplayPropertyName&lt;/code&gt; that uses &lt;code&gt;nameof&lt;/code&gt; to get the name of the property. By using &lt;code&gt;nameof(Name)&lt;/code&gt;, we can avoid hardcoding the property name as a string, which can help prevent errors if the property name changes in the future.&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;Main&lt;/code&gt; method, we also use &lt;code&gt;nameof(Example)&lt;/code&gt; to get the name of the &lt;code&gt;Example&lt;/code&gt; class as a string. This can be useful for things like generating dynamic SQL queries or working with reflection.&lt;/p&gt;

&lt;p&gt;Overall, C# Nameof is a handy feature that can improve the maintainability and readability of your code by removing hardcoded strings and making it easier to reference variable names, type names, and member names. Give it a try in your own projects and see the benefits for yourself!&lt;/p&gt;

</description>
      <category>csharp</category>
    </item>
    <item>
      <title>How to Sort Two-Dimensional Array in C# by Selected Column Index in Selected Column Sort Order</title>
      <dc:creator>Nick</dc:creator>
      <pubDate>Sat, 09 Mar 2024 09:22:18 +0000</pubDate>
      <link>https://dev.to/homolibere/how-to-sort-two-dimensional-array-in-c-by-selected-column-index-in-selected-column-sort-order-3ffl</link>
      <guid>https://dev.to/homolibere/how-to-sort-two-dimensional-array-in-c-by-selected-column-index-in-selected-column-sort-order-3ffl</guid>
      <description>&lt;p&gt;In C#, sorting a two-dimensional array by a selected column index in a selected column sort order can be achieved using the Array.Sort method. This method takes in the array to be sorted and a comparison delegate that defines the sorting order based on the selected column index.&lt;/p&gt;

&lt;p&gt;First, let's create a two-dimensional array to be sorted. For this example, we will create a matrix of integers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;[,]&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;[,]&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="m"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;3&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="m"&gt;9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;8&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, we will define a method that will be used as the comparison delegate for sorting based on a selected column index and sort order:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;CompareRowsByColumn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;[,]&lt;/span&gt; &lt;span class="n"&gt;array&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;column&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="k"&gt;ascending&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;comparison&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;array&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;column&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;CompareTo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;array&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;column&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;ascending&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="n"&gt;comparison&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;-&lt;/span&gt;&lt;span class="n"&gt;comparison&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we can use the Array.Sort method to sort the array by a selected column index in ascending order:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;selectedColumnIndex&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="k"&gt;ascending&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Enumerable&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GetLength&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nf"&gt;ToArray&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
           &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;CompareRowsByColumn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;selectedColumnIndex&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;ascending&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;The code above will sort the array by the selected column index (1 in this case) in ascending order. To sort the array in descending order, simply set the &lt;code&gt;ascending&lt;/code&gt; variable to false.&lt;/p&gt;

&lt;p&gt;By following these steps, you can easily sort a two-dimensional array in C# by a selected column index in a selected column sort order. This technique can be applied to arrays of various types, not just integers. Experiment with different data types and sorting criteria to achieve your desired results.&lt;/p&gt;

</description>
      <category>csharp</category>
    </item>
    <item>
      <title>A Comprehensive Guide to Nullable Reference Types in C# 10</title>
      <dc:creator>Nick</dc:creator>
      <pubDate>Fri, 08 Mar 2024 08:45:38 +0000</pubDate>
      <link>https://dev.to/homolibere/a-comprehensive-guide-to-nullable-reference-types-in-c-10-4lc3</link>
      <guid>https://dev.to/homolibere/a-comprehensive-guide-to-nullable-reference-types-in-c-10-4lc3</guid>
      <description>&lt;p&gt;When it comes to coding in C#, one of the most important concepts to understand is nullable reference types. With the release of C# 10, nullable reference types have received a significant upgrade, making them even more powerful and useful for developers.&lt;/p&gt;

&lt;p&gt;In this comprehensive guide, we will take a deep dive into nullable reference types in C# 10, covering everything from the basics to advanced techniques. We will explore how nullable reference types can help you write cleaner, safer code and avoid common pitfalls in your applications.&lt;/p&gt;

&lt;p&gt;One of the key benefits of nullable reference types is that they allow you to explicitly express whether a variable or parameter can be null. This can help prevent null reference exceptions at runtime, making your code more robust and reliable. Nullable reference types also provide valuable information to the compiler, allowing it to catch potential null reference errors at compile time.&lt;/p&gt;

&lt;p&gt;To enable nullable reference types in C# 10, you can use the "nullable enable" directive at the top of your C# file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="cp"&gt;#nullable enable
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once nullable reference types are enabled, you can use the nullable annotation syntax to indicate whether a variable or parameter can be null. For example, you can declare a nullable string like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="n"&gt;nullableString&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the "?" after the string type specifier indicates that the variable nullableString can be null. If you try to assign a non-null value to nullableString, the compiler will generate a warning to alert you to a potential null reference error.&lt;/p&gt;

&lt;p&gt;You can also use the "null-forgiving" operator "!" to explicitly tell the compiler that you are aware of a potential null reference and want to access the value without checking for null:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;nonNullableString&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;nullableString&lt;/span&gt;&lt;span class="p"&gt;!;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, you should use the null-forgiving operator sparingly, as it can lead to null reference exceptions at runtime if misused.&lt;/p&gt;

&lt;p&gt;In addition to nullable reference types, C# 10 also introduces a new feature called "nullable context," which allows you to control the nullability of types within a specific code block. You can use the "nullable enable" and "nullable disable" directives to change the nullability context of the code block:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="cp"&gt;#nullable enable
&lt;/span&gt;&lt;span class="c1"&gt;// Code with nullable reference types enabled&lt;/span&gt;

&lt;span class="cp"&gt;#nullable disable
&lt;/span&gt;&lt;span class="c1"&gt;// Code with nullable reference types disabled&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By using nullable reference types and nullable context effectively, you can write cleaner, safer code in C# 10 and avoid common pitfalls related to null references. With a better understanding of nullable reference types, you can take your coding skills to the next level and build more reliable applications.&lt;/p&gt;

&lt;p&gt;Overall, nullable reference types in C# 10 are a powerful feature that can help you write better code and catch potential null reference errors early in the development process. By mastering nullable reference types, you can become a more proficient C# developer and build robust, high-quality applications.&lt;/p&gt;

</description>
      <category>csharp</category>
    </item>
    <item>
      <title>A Guide To Crafting Immutable Objects With C# 10 Init-Only Properties</title>
      <dc:creator>Nick</dc:creator>
      <pubDate>Thu, 07 Mar 2024 07:36:42 +0000</pubDate>
      <link>https://dev.to/homolibere/a-guide-to-crafting-immutable-objects-with-c-1039s-init-only-properties-4n6b</link>
      <guid>https://dev.to/homolibere/a-guide-to-crafting-immutable-objects-with-c-1039s-init-only-properties-4n6b</guid>
      <description>&lt;p&gt;In the world of object-oriented programming, immutability is a highly desirable trait for objects. Immutable objects are objects whose state cannot be changed once they are created. This can lead to more predictable and easier-to-understand code, as well as less potential for bugs.&lt;/p&gt;

&lt;p&gt;In C# 10, a new feature called init-only properties was introduced to make it easier to create immutable objects. Init-only properties allow you to set the initial value of a property when an object is created, but prevent the property from being changed afterwards.&lt;/p&gt;

&lt;p&gt;Let's take a look at how we can use init-only properties to create immutable objects in C#:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Person&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;FirstName&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;init&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;LastName&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;init&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;Person&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;firstName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;lastName&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;FirstName&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;firstName&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;LastName&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;lastName&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Program&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;Main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;Person&lt;/span&gt; &lt;span class="n"&gt;person&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Person&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"John"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Doe"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="c1"&gt;// person.FirstName = "Jane"; // Compile error - cannot modify init-only property&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the code snippet above, we have defined a &lt;code&gt;Person&lt;/code&gt; class with two init-only properties: &lt;code&gt;FirstName&lt;/code&gt; and &lt;code&gt;LastName&lt;/code&gt;. When an instance of the &lt;code&gt;Person&lt;/code&gt; class is created, the values of these properties are set using the constructor. Once the object is created, the values of these properties cannot be changed.&lt;/p&gt;

&lt;p&gt;This can be particularly useful when working with collections of objects, where immutability can prevent accidental modifications of the objects' state. By using init-only properties, you can ensure that your objects remain in a consistent state throughout their lifetime.&lt;/p&gt;

&lt;p&gt;In conclusion, utilizing C# 10's init-only properties is a powerful tool for crafting immutable objects. By leveraging these features in your code, you can create more robust and predictable applications. Immutable objects can lead to cleaner, more maintainable code and reduce the potential for bugs. So next time you're designing your classes, consider using init-only properties to create immutable objects.&lt;/p&gt;

</description>
      <category>csharp</category>
    </item>
    <item>
      <title>Best Practices for Handling Exceptions in C#</title>
      <dc:creator>Nick</dc:creator>
      <pubDate>Wed, 06 Mar 2024 07:41:49 +0000</pubDate>
      <link>https://dev.to/homolibere/best-practices-for-handling-exceptions-in-c-18c1</link>
      <guid>https://dev.to/homolibere/best-practices-for-handling-exceptions-in-c-18c1</guid>
      <description>&lt;p&gt;Handling exceptions is an important aspect of creating robust and reliable software in C#. By properly handling exceptions, you can ensure that your application gracefully handles unforeseen errors and prevents crashes. In this post, we will discuss some best practices for handling exceptions in C#.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Use try-catch blocks: The most common way to handle exceptions in C# is to use try-catch blocks. This allows you to encapsulate code that may throw an exception within a try block, and catch and handle any exceptions that are thrown in a catch block. This prevents your application from crashing when an exception occurs.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// code that may throw an exception&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Exception&lt;/span&gt; &lt;span class="n"&gt;ex&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// handle the exception&lt;/span&gt;
    &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"An error occurred: "&lt;/span&gt; &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="n"&gt;ex&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Message&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Be specific in catching exceptions: It is important to be as specific as possible when catching exceptions. This allows you to handle different types of exceptions differently, rather than using a generic catch block for all exceptions.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// code that may throw an exception&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ArgumentNullException&lt;/span&gt; &lt;span class="n"&gt;ex&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// handle the ArgumentNullException&lt;/span&gt;
    &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"An argument was null: "&lt;/span&gt; &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="n"&gt;ex&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Message&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Exception&lt;/span&gt; &lt;span class="n"&gt;ex&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// handle any other exceptions&lt;/span&gt;
    &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"An error occurred: "&lt;/span&gt; &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="n"&gt;ex&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Message&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Use finally blocks: Finally blocks are used to execute code after a try-catch block, regardless of whether an exception has occurred or not. This is useful for cleaning up resources or performing other actions that need to be done regardless of the outcome of the try block.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// code that may throw an exception&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Exception&lt;/span&gt; &lt;span class="n"&gt;ex&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// handle the exception&lt;/span&gt;
    &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"An error occurred: "&lt;/span&gt; &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="n"&gt;ex&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Message&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;finally&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// cleanup code&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Use custom exceptions: In addition to built-in exceptions in C#, you can also create your own custom exceptions to handle specific errors in your application. This allows you to add more context to the exception and provide more detailed information to the user or developer.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CustomException&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Exception&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;CustomException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;base&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;try&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;CustomException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Custom error message"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;CustomException&lt;/span&gt; &lt;span class="n"&gt;ex&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"An error occurred: "&lt;/span&gt; &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="n"&gt;ex&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Message&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Exception&lt;/span&gt; &lt;span class="n"&gt;ex&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"An error occurred: "&lt;/span&gt; &lt;span class="p"&gt;+&lt;/span&gt; &lt;span class="n"&gt;ex&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Message&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By following these best practices for handling exceptions in C#, you can ensure that your application is more robust and reliable, and able to gracefully handle errors without crashing. Remember to be specific in catching exceptions, use try-catch blocks, and consider using custom exceptions for more detailed error handling.&lt;/p&gt;

</description>
      <category>csharp</category>
    </item>
    <item>
      <title>How Do I Open an OCR File in PDF?</title>
      <dc:creator>Nick</dc:creator>
      <pubDate>Tue, 05 Mar 2024 07:45:43 +0000</pubDate>
      <link>https://dev.to/homolibere/how-do-i-open-an-ocr-file-in-pdf-1fhl</link>
      <guid>https://dev.to/homolibere/how-do-i-open-an-ocr-file-in-pdf-1fhl</guid>
      <description>&lt;p&gt;If you're looking to open an OCR (Optical Character Recognition) file in PDF using C#, you're in the right place. OCR files are commonly used to convert scanned documents into editable text, making them a valuable tool for digitizing paper documents.&lt;/p&gt;

&lt;p&gt;To open an OCR file in PDF using C#, you can use the iTextSharp library, which is a popular PDF manipulation library for .NET. Below is an example code snippet that demonstrates how to open an OCR file in PDF using C#:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;iTextSharp.text&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;iTextSharp.text.pdf&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;System.IO&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;OpenOCRFileInPDF&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Program&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;Main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;ocrFilePath&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;@"C:\path\to\ocrfile.txt"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;pdfFilePath&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;@"C:\path\to\output.pdf"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

            &lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;FileStream&lt;/span&gt; &lt;span class="n"&gt;fs&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;FileStream&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pdfFilePath&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;FileMode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Create&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;FileAccess&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;FileShare&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;None&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
            &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;Document&lt;/span&gt; &lt;span class="n"&gt;document&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Document&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
                &lt;span class="n"&gt;PdfWriter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GetInstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;document&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

                &lt;span class="n"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Open&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

                &lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;StreamReader&lt;/span&gt; &lt;span class="n"&gt;reader&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;StreamReader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ocrFilePath&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
                &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;reader&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ReadLine&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="p"&gt;!=&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                    &lt;span class="p"&gt;{&lt;/span&gt;
                        &lt;span class="n"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Paragraph&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
                    &lt;span class="p"&gt;}&lt;/span&gt;
                &lt;span class="p"&gt;}&lt;/span&gt;

                &lt;span class="n"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Close&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;

            &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"OCR file successfully converted to PDF."&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this code snippet, we first specify the paths to the OCR file and the output PDF file. We then create a new PDF document using the iTextSharp library and open it for writing. We read the text content from the OCR file line by line and add each line as a paragraph to the PDF document. Finally, we close the document and output the success message.&lt;/p&gt;

&lt;p&gt;With this code, you can easily open an OCR file in PDF using C# and the iTextSharp library. This can be a useful tool for automating the conversion of scanned documents into editable PDF files.&lt;/p&gt;

</description>
      <category>csharp</category>
    </item>
  </channel>
</rss>
