Posts

Passing Arrow Functions vs Attaching Arrow Functions in JavaScript

  Passing Arrow Functions vs Attaching Arrow Functions in JavaScript While learning JavaScript arrow functions, I came across the terms passing an arrow function and attaching an arrow function . At first, these concepts seemed similar, but they describe two different things: Passing a function as a value to another function (callback) Attaching a function to an object as a method This article explains the difference with examples. What are Arrow Functions? Arrow functions were introduced in ES6 (ECMAScript 2015) . They provide a shorter syntax for writing functions. The traditional way of writing a function: function add ( a, b ) { return a + b; } The same function using an arrow function: (a, b) => a + b; Arrow functions are especially useful when working with callbacks because functions in JavaScript can be passed around as values. Passing a Function (Callback Function) Passing a function means giving a function as an argument to another function. function add ( a, b ...

Master C# Unit Testing with xUnit - A Beginner's Guide

Image
  Master C# Unit Testing with xUnit – A Beginner’s Guide Are you looking to improve your C# skills and write better, more reliable code? Unit testing is a game-changer, and in my latest YouTube video, I’ll walk you through how to use xUnit to write and run unit tests effectively in C#! 🔥 What You’ll Learn in This Video ✅ Setting up xUnit in your C# project ✅ Writing your first unit test ✅ Running and debugging tests ✅ Best practices for cleaner, more efficient tests Whether you’re new to unit testing or just looking to refine your skills, this video is packed with valuable insights to help you level up your development game. 📺 Watch now: Master C# Unit Testing with xUnit Don’t forget to like, comment, and subscribe if you find it helpful! 🚀 #CSharp #xUnit #UnitTesting Please find the code used in this video below. using FizzBuzzLibrary; namespace FizzBuzz.Tests { public class FizzBuzzTest { [Theory] [InlineData(15, "FizzBuzz"...

Different ways to install Nuget Package in Visual Studio 2022

Image
In this tutorial, I’ll show you different ways to install a NuGet package in Visual Studio 2022 . NuGet is the package manager for .NET, and it’s essential for adding libraries and tools to your projects. Whether you’re a beginner or an experienced developer, this guide will walk you through the process step-by-step. Installing NuGet packages is a common task in .NET development, and Visual Studio 2022 makes it incredibly easy. Below, I’ve embedded a YouTube video tutorial that demonstrates the entire process. Watch the video to see it in action, or follow the written steps below. Different Ways to Install a NuGet Package in Visual Studio 2022: Using the NuGet Package Manager: Right-click on your project in the Solution Explorer . Select Manage NuGet Packages . Search for the package you want to install (e.g., Newtonsoft.Json ). Click Install . Using the Package Manager Console: ...

Fix git src refspec master does not match any, failed to push some refs in git and github

Image
Are you encountering the "git src refspec master does not match any, failed to push some refs" error while trying to push your commits to GitHub? Don’t worry! In this tutorial, I’ll walk you through the steps to fix this common Git error and get your code pushed successfully. This error usually occurs when Git can’t find the branch you’re trying to push or when there are no commits to push. Watch the video tutorial above for a visual guide, or follow the steps below: Steps to Fix the Error: Verify your remote URL with git remote -v . Create an initial commit if your branch is empty using git commit -m "Initial commit" . Push your branch to GitHub using git push origin branch-name . Check if you’re on the correct branch using git branch . For a more detailed explanation, watch the video tutorial embedded above. If you found this guide helpful, feel free to leave a comment below or share it with others who ...

Unable to add controller to ASP.NET, Controller option greyed out / disabled

Image
 If you are unable to add controller to ASP.NET due to controller option being greyed out. Please check out my 1 minute youtube video which provides solution to this issue.  Thank you very much,

How to install Nuget Package in Visual Studio 2022

Image
 I've linked my YouTube video below, where I explain how to install Nuget Package in Visual Studio 2022

How to check .NET (dot net) framework version in Visual Studio Code (VS Code).

Image
I've linked my YouTube video below, where I explain how to check .NET (dot net) framework version in Visual Studio Code (VS Code).

Understanding C# Interface under 10 minutes with example and a coding challenge

Image
 I've linked my YouTube video below, where I explain interface in C# with a practical example and a fun coding challenge at the end. Below the video, you'll find the actual code featured in the tutorial. Try solving the coding challenge yourself before checking out the solution provided at the end of this blog - it’s a fantastic way to test your understanding and sharpen your skills! Happy coding! 😊 Actual code featured in the tutorial using System; using System.Collections.Generic; namespace Interface_App { internal class Program { static void Main(string[] args) { List flyingThings = new List { new People(), new Airplane() }; foreach (var thing in flyingThings) { thing.Fly(); thing.Glide(); Console.WriteLine(); } List speakingThings = new List { new Peopl...

CSharp C# Method Overloading with Practical Example and Coding Challenge / Coding Excercise

Image
I've linked my YouTube video below, where I explain method overloading in C# with a practical example and a fun coding challenge at the end. Below the video, you'll find the actual code featured in the tutorial. Try solving the coding challenge yourself before checking out the solution provided at the end of this blog - it’s a fantastic way to test your understanding and sharpen your skills! Happy coding! 😊 Actual code featured in the tutorial using System; namespace MethodOverLoading { internal class Program { static void Main(string[] args) { Log log = new Log(); log.DisplayLog("Welcome to this program."); log.DisplayLog("You have successfully created the file on ", DateTime.Now); log.DisplayLog("Requires user authentication", 401); } } public class Log { public void DisplayLog(string message) { Console.WriteLine(message...

CSharp C# Method Overriding in with a Practical Example and Coding Challenge

Image
I've linked my YouTube video below, where I explain method overriding in C# with a practical example and a fun coding challenge at the end. Below the video, you'll find the actual code featured in the tutorial. I have used virtual method in the example so i have used abstract class and method for the coding challenge solution. You can solve using both ways. Try solving the coding challenge yourself before checking out the solution provided at the end of this blog - it’s a fantastic way to test your understanding and sharpen your skills! Happy coding! 😊 Actual code featured in the youtube tutorial above using System; namespace Method_Overriding { internal class Program { static void Main(string[] args) { Engineer engineer = new Engineer(); engineer.Work(); FrontEndEngineer frontEnd = new FrontEndEngineer(); frontEnd.Work(); BackEndEngineer backEnd = new BackEndEngineer(); b...

Understanding Classes in C#

Image
Introduction In C# class is a blueprint for creating objects. It contains data (properties) and behaviour (methods). We can build multiple objects with distinct properties and methods using classes without having to repeat the code. Class Syntax: Creating a generic C# Class public class Car //car is the class name and Pascal case { public string Model { get; set; } //properties public string Color { get; set; } public void Start() //method { Console.WriteLine("Car started."); } public void Stop() //method { Console.WriteLine("Car stopped."); } } A generic class in C# is created using a class keyword followed by class name. Class name, property name, method name must always be Pascal case i.e. Starting letter must be capital case. Class can have different properties and methods. We cannot use the class directly without creating an object. In order to use class we must create an object which is an inst...

C# Date Time common concepts

C# DateTime is a value type (struct) that represents a specific date and time. It's found in System namespace. This feature comes in handy whenever we need to work with date and time. We can create or instantiate a DateTime object as follows: DateTime date = new DateTime(2019, 03, 29, 15, 0, 0); In the above example year, month, day, hour, minutes and seconds have been provided as an argument. If we print date using Console.WriteLine() then  it will show following output.  Console.WriteLine(date) //-->/29/2019 3:00:00 PM We can also use the same principle to create a DateTime object representing the current date and time DateTime now = DateTime.Now; We can compare the two dates if (date > now) { Console.WriteLine(true); } else Console.WriteLine(false); Above example prints false as the date is smaller than the now. We can also format DateTime object as per our requirements. An example static method is shown below public static string Description(Dat...