Pull to refresh
59.35

C# *

Multi-paradigm programming language encompassing strong typing, imperative, declarative, functional, generic, object-oriented (class-based), and component-oriented programming disciplines

Show first
Rating limit
Level of difficulty

Tree-sitter and Preprocessing: A Syntax Showdown

Level of difficultyMedium
Reading time5 min
Views864

According to the description,


Tree-sitter is a parser generator tool and an incremental parsing library. It can build a concrete syntax tree for a source file and efficiently update the syntax tree as the source file is edited.

But how does Tree-sitter handle languages that require a preprocessing stage?

Read more →

Spans in C#: Your Best Friend for Efficient Coding

Level of difficultyEasy
Reading time5 min
Views2.9K

I’ve been wanting to sort it out about String memory optimization and all these ways to improve the performance and memory usage for Collections and Arrays in C#(as you remember String is an array of chars, loaded a bit differently but anyway) code. I finally managed to find some time to dive deeper into the System.Span.

I have put together this guide to share what I’ve learned. It’s filled with practical tips and examples to help you leverage Spans in your own projects. If you want to optimize your C# code, this guide is a great place to start!

Read more

Enabling Cross-Process Dialogue with C# Sockets

Level of difficultyMedium
Reading time4 min
Views927

In the ever-evolving landscape of software development, communication between processes has been a fundamental requirement since the inception of computer networking. As technology advanced, the need for efficient and reliable inter-process communication (IPC) mechanisms became increasingly crucial. One such mechanism that has stood the test of time is the socket.
Sockets trace their origins back to the early days of computer networking in the 1970s. The concept was first introduced in the Unix operating system by researchers at the University of California, Berkeley, as part of their work on the ARPANET project, which eventually evolved into the modern internet. Sockets were designed to provide a standardized interface for network communication, allowing processes to exchange data across different machines and networks.
Initially, sockets were primarily used for network programming tasks, such as building client-server applications and facilitating communication between distributed systems. However, their versatility soon became apparent, and sockets found their way into various domains, including inter-process communication (IPC) within a single machine.
Over the years, sockets have undergone numerous enhancements and standardizations, with the Berkeley Software Distribution (BSD) sockets becoming the de facto standard for network programming. This standard was later adopted by other operating systems, including Microsoft Windows, ensuring cross-platform compatibility and enabling widespread adoption.
In the world of software development, communication between processes is a common requirement, whether it’s a client-server architecture, distributed systems, or inter-process communication (IPC). Sockets provide a powerful mechanism for processes to exchange data efficiently and reliably. This article explores a simple implementation of a TCP client-server communication using sockets in C#, showcasing the versatility and robustness of this time-tested technology.

Read more

Could async/await magic create thread, or it is always: “There is no thread”?

Level of difficultyMedium
Reading time4 min
Views933

When we are told “There is no thread” we can easily come to an opinion that it is impossible at ALL that asynchronous operation could create thread, but it would be wrong opinion. Simple code example proves the opposite.

Those who are easy to treat the sentence as the universal rule are easy to understand. They would like to simplify the subject and to cut amount of theory they should study and remember. Besides to many it is new level of knowledge to discover there is other layer of classes to manage async-operations behavior beside the Tasks and and SynchronizationContext is only one among them.

Read more

Why x^0 = 1 visually

Reading time3 min
Views1.2K

The traditional definition for the operation of exponentiation to a natural power (or a positive integer) had introduced approximately as follows:

Exponentiation is an arithmetic operation originally defined as the result of multiple multiplications a number by itself.

But the more precise formulation is still different:

Raising a number X to an integer power N is an arithmetic operation defined as the result of multiple [N by mod times] multiplications or divisions one by number X.

Let's figure it out under the cut! >>

State Management for processes flow

Reading time12 min
Views1.2K

Most of the processes that people use in their work lives can be represented as some object that goes through some flow. Each flow contains many stages, in each one of them the object can be manipulated by certain group of users.

In this article I want to suggest an approaches to effectively handle such flow based systems. 

Read more

NFun — expression evaluator for .Net

Reading time6 min
Views2.6K

Nfun is an embedded language and expression executor that supports primitive types, arrays, structures and lambda expressions.

Most likely, you have already met tasks that require such a tool, and in this article I want to show examples of its application, its capabilities and why it may be useful to you.

Let's learn some nFun!

How to handle Stale Element Reference Exception in E2E testing of modern SPA applications

Reading time5 min
Views3.2K

Hello everyone, my name is Denis, I am Software Developer Engineer in Test (SDET) at Bimeister. I am in charge of test software development - frameworks, automated tests, CI Pipelines configuration, and much more.

In this article, I will tell you how we defeated the Stale Element Reference Exception while developing our framework using Selenium WebDriver and C#.

Read more

Unity: What is a Coroutine and why is there an IEnumerator

Reading time5 min
Views16K

The title of the article is a question I was asked in an interview for a Middle position. In this article, we will look at Unity coroutines, what they are, and at the same time we will capture the topic of Enumerator \ Enumerable in C # and a little secret of foreach. The article should be very useful for beginners.

Read more

Why does my app send network requests when I open an SVG file?

Reading time8 min
Views2.2K

0923_SVG_XXE_ru/image1.png


You decided to make an app that works with SVG. Encouraged by the enthusiasm, you collected libraries and successfully made the application. But suddenly you find that the app is sending strange network requests. And data is leaking from the host-machine. How so?

Read more →

ECS: under the hood

Reading time6 min
Views8.5K

This is the translation of my article about ECS. Original (in Russian).

ECS (Entity Component System) is an architectural pattern used in game development.

In this article, I am going to describe some of the general principles of ECS frameworks' inner workings and some of the problems I have faced during the development of my own.

When I first started learning about ECS everything seemed wonderful, but only in theory. I needed some real practice to make sure that all that they were saying about ECS was true.

I’ve tried different frameworks with different engines and programming languages. Mostly it was the gorgeous EnTT framework that I used with the Godot engine and LeoECS with Unity. I haven’t tried Unity’s native ECS from DOTS because it was rather unpolished at the time I was starting.

After a while, I got enough practical experience with ECS but it was still unclear to me how all this magic works under the hood. There are a few good blogs about ECS development (https://skypjack.github.io/ from the author of EnTT and https://ajmmertens.medium.com/ from the author of Flecs) but none of them gave me enough understanding about how they are implemented. So eventually, following Bender’s example, I decided that I’m gonna make my own ECS =)

Read more

Vulnerabilities due to XML files processing: XXE in C# applications in theory and in practice

Reading time16 min
Views1.3K

How can simple XML files processing turn into a security weakness? How can a blog deployed on your machine cause a data leak? Today we'll find answers to these questions, learn what XXE is and how it looks like.


0918_XXE_BlogEngine/image1.png

Read more →

Re-checking PascalABC.NET

Reading time8 min
Views609

Welcome all fans of clean code! Today we analyze the PascalABC.NET project. In 2017, we already found errors in this project. We used two static analysis tools (more precisely, plugins for SonarQube): SonarC# and PVS-Studio. Today, we analyze this project with the latest version of the PVS-Studio analyzer for C#. Let's see what errors we can find today, especially when our analyzer has become more advanced and got new features: it can find more exquisite errors and potential vulnerabilities.


0912_PascalABCNET_2/image1.png

Read more →
1
23 ...

Authors' contribution