Author: admin
-
C# interview questions: Difference Between Abstract Class and Interface in C#
•
Difference Between Abstract Class and Interface in C In C#, both abstract classes and interfaces are used to define abstract types that specify a set of functionalities that other classes must implement. However, they have different rules, use cases, and behaviors. Let’s dive into the key differences, explain when to…
-
C# interview questions: What is the Difference Between `const`, `readonly`, and `static` in C#
•
What is the Difference Between const, readonly, and static in C#? In C#, there are three commonly used keywords to manage constants and static members: const, readonly, and static. While they all affect how values are stored and used, they have different applications and rules. Quick Answer: const: Represents constant…
-
Design Pattern 101: Singleton Pattern
•
Singleton Pattern (单例模式) in Software Development The Singleton Pattern is one of the most commonly used creational design patterns. It restricts the instantiation of a class to one single instance and provides a global point of access to that instance. Singleton is typically used when exactly one object is needed…
-
C# interview questions: Can the garbage collector claim unmanaged objects?
•
Introduction In this blog, we will explore whether the garbage collector (GC) in languages like C# and Java can claim unmanaged objects, and how memory management works for both managed and unmanaged resources. 在这篇博客中,我们将探讨 垃圾回收器(GC) 是否能够回收非托管对象,以及托管资源和非托管资源的内存管理是如何工作的。 Quick Answer No, the garbage collector cannot claim unmanaged objects directly. It only manages…
-
C# interview questions: Does .NET support multiple programming languages?
•
Introduction In this blog, we’ll explore whether .NET supports multiple programming languages and how it enables developers to write code in a variety of languages while using the same framework. We will also dive into the benefits and key features of this capability. 在这篇博客中,我们将探讨 .NET 是否支持多种编程语言,以及它如何使开发人员能够在使用相同框架的同时用多种语言编写代码。我们还将深入了解这一功能的好处和关键特性。 What is the Pattern?…
-
C# interview questions: JIT (Just In Time compiler)
•
In this blog, we’ll explore JIT (Just In Time compiler), a vital component in modern programming languages, enhancing performance and execution efficiency. We will go over what JIT is, its advantages, and how it impacts code execution. 在这篇博客中,我们将探讨 JIT(即时编译器),这是现代编程语言中提高性能和执行效率的重要组成部分。我们将讨论 JIT 是什么,它的优点以及它如何影响代码执行。 What is the Pattern? JIT (Just In Time compiler)…
-
C# interview questions
•
C# interview questions As of September 2024, the current versions of C#, .NET Core, and .NET are as follows: C# Version: C# 12 is the latest stable release. It introduces several new features, including primary constructors for classes and structs, collection expressions, ref readonly parameters, and more. C# 12 is…
-
Python 101: `==` and `is`
•
In Python, == and is are used for different purposes, and understanding their differences is essential for writing correct code. 1. ==: Equality Operator Purpose: It checks whether the values of two objects are equal. Usage: When you want to compare if two objects have the same value, use ==.…
-
Python 101: lambda function
•
In Python, a lambda function is a small anonymous function defined using the lambda keyword. It is typically used for short, simple operations that are needed temporarily, without defining a full function with the def keyword. The syntax for a lambda function is: lambda arguments: expression Key Points: lambda functions…
-
LeetCode: 746 Min Cost Climbing Stairs
•
Let’s solve LeetCode 746: Min Cost Climbing Stairs using the provided template, including both iterative and recursive approaches. Problem You are given an integer array cost where cost[i] is the cost of i-th step on a staircase. Once you pay the cost, you can either climb one or two steps.…