Optimize Your Code: A Guide to Identifying and Avoiding Common C# Pitfalls
Programming in CSharp
by anghelvalentin
1M ago
Ignoring the Dispose Method This is by far the worst thing that happens to many juniors. The IDisposable interface is implemented in many classes. This interface has a single method called Dispose. This method is used to free unmanaged resources like database connections, file streams, or unmanaged memory. In C# you can call directly the Dispose method or you can use a using block. using (SqlConnection sqlConnection= new SqlConnection("connectionsstring")) { sqlConnection.Query("Query the database"); } // Dispose method is called automatically when the block is exited Since C# version 8 ..read more
Visit website
Master C# Operators: Top 12 Interview Questions
Programming in CSharp
by anghelvalentin
2M ago
Operators’ questions are trendy for C# job interviews. Usually, the interviewers ask the juniors for quizzes regarding operators, but you can also receive these types of questions. So let’s start to prepare with some questions: What will be printed? Console.WriteLine('a'+'b'+'c'); Answer: 294, because the summation of chars will give you a number. First, the chars are converted to the ASCII code. For example, the ASCII code of the letter a is 97. You don’t need to know the numeric code, but remember that you don’t concatenate chars using the sign plus. What will be printed? Console.WriteLin ..read more
Visit website
.NET Core Interview Questions
Programming in CSharp
by anghelvalentin
1y ago
As a .NET developer, I have been in many interviews at companies like Microsoft, Deloitte, and others from Forbes 500. A big part of the interviews was about data structures and algorithms. I also received many .NET Core and ASP.NET questions. I will try to give you the questions that appear the most in the interviews. What is SOLID? The SOLID principles are a set of guidelines for object-oriented programming. These principles are intended to make software designs more understandable, flexible, and maintainable. SOLID stands for: Single responsibility. This means that a class should do only o ..read more
Visit website
Razor Pages vs MVC – Which One is the Best for Your Project?
Programming in CSharp
by anghelvalentin
1y ago
In ASP.NET, most developers use one of the two architectural patterns to build web Applications: Razor Pages and Model View Controller. They are slightly different in structure and development approach. This GitHub issue is why Microsoft tends to bring the Razor Pages in front of .NET documentation. More people commented against Razor Pages, but others came up with some advantages why choosing this architecture. I will try to give you a fair comparison of these two architectural styles. Razor Pages Razor Pages is a new feature introduced in ASP.NET Core 2. This is a new architectural style tha ..read more
Visit website
Implementing Singleton Pattern In C#
Programming in CSharp
by anghelvalentin
1y ago
Singleton is a creational design pattern. I think even a junior developer should know at least this design pattern. It’s the most used design pattern and is simple. This pattern solves the problem when you want to have only one instance. For example, let’s think about a connection to a server. You don’t want to open multiple connections from the same application, but you instantiate the object from many other classes. Practically, you provide a global point of access to that instance. The intent is to have only one instance of the class in the system, which makes it possible for other objects ..read more
Visit website
GitHub Actions for publishing ASP.NET Docker Image to the registry
Programming in CSharp
by anghelvalentin
1y ago
I am a big fan of Docker Images. I usually host my websites inside a container and use Docker Hub to host my images. Whenever I want to do a release, I manually push my image to the Docker Hub. This takes a lot of time because my applications are pretty big. So, I am trying to find a solution to automate this step. The GitHub Actions were my best choice because I already hosted my source code there. GitHub actions allow you to automate workflows that imply building, running automated tests, or deploying. You write a configuration file that specifies the workflow steps; then, a GitHub job will ..read more
Visit website
Solving FizzBuzz problem in C#
Programming in CSharp
by anghelvalentin
1y ago
FizzBuzz problem is a simple algorithm test given in interviews. I think I received this at least five times. So you will probably also receive it at your following interview. The problem sounds like this: Write a program that prints the number from 1 to N: If an integer is divisible by 3, then print Fizz. In case it is divisible by five, then print Buzz. If the number is divisible by both 3 and 5, then print FizzBuzz. In other cases, print the number. Here is an example of a sequence: 1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz Solution for FizzBuzz interview question To sol ..read more
Visit website
Rin – Request/Response Inspector Middleware for ASP.NET Core
Programming in CSharp
by anghelvalentin
1y ago
Rin is a .NET library for ASP.NET Core, which inspects the requests and responses of the application. Like MiniProfiler, Rin is a middleware that captures the traffic between the application and the user. It shows you a friendly UI about the requests in the browser. You can see how much time the request took and each method in particular. Using this library, you can debug your application more efficiently. Configure Rin on your ASP.NET website Install the Nuget Packages Install-Package Rin Install-Package Rin.Mvc Configure the Rin Logger var builder = WebApplication.CreateBuilder(args); bu ..read more
Visit website
Chrome and Edge Extensions for Developers
Programming in CSharp
by anghelvalentin
1y ago
I am a big fan of extensions and plugins for any software. I like to enhance the features of any application. In the article 12 Visual Studio Extensions, I’ve presented a couple of VS extensions that can enhance your development time. Today’s article will give you a presentation of my browser extensions. These plugins are for Chrome or Edge browsers, but most can also be found on the Firefox store. uBlock Origin The uBlock extension is by far the best ad blocker. Why do I recommend this extension for developers? First of all, you will browse the Internet much faster. For example, 7% of request ..read more
Visit website
Best C# courses on Pluralsight
Programming in CSharp
by anghelvalentin
1y ago
C# is one of the most popular programming languages. Every day thousands of students start to learn it. One way to learn the basics of C# is to watch video courses on platforms like YouTube, Linkedin Learning, Coursera, Khan Academy, or Pluralsight. Pluralsight is a video course platform that is more focused on programming, especially from the Microsoft world. Here is a list of the best video courses for dotnet and C# programmers. C# Fundamentals by Scott Allen C# Fundamentals offered by Scott Allen is one of the most comprehensive courses on the platform. Scott Allen was one of the most popul ..read more
Visit website

Follow Programming in CSharp on FeedSpot

Continue with Google
Continue with Apple
OR