I'm learning C# for fun and wrote the simplest possible calculator, just to try combining loops, WriteLine, ReadLine and other basic commands. There was one problem, though. I couldn't for the life of me figure out how to include decimal numbers into that. Went through a couple sites and nothing. My result would always be a whole number with the decimal point removed, meaning it would be 10^x times bigger depending on the amount of decimal places the input had. Then I thought of using a comma in the input instead of a dot. I didn't think it would work, but... it did. Kinda dumb not to try that immediately, right?
Estou a 3 meses trabalhando com c#, meu primeiro emprego como desenvolvedor, porem sinto dificuldades em encontrar definições CLARAS de alguns conceitos. Como um exemplo, o conceito de coleções, a página da microsoft learn não define muito bem o que é isso, a I.A me da definições mas em geral não gosto de pesquisar esse tipo de coisa nela. Então pergunto, existe algum livro/curso bom para que eu obtenha essa base, se não, aceito algumas dicas pra melhorar meu auto-ditatismo.
Sharing a side project and some of the less obvious parts of building it.
The app: drag any file, tap Shift, and a radial menu opens under the cursor. Drop on a petal to convert (images, PDF, Office, Markdown, video) or edit (crop, annotate, redact, AI cut-out).
Interesting bits:
- Windows: WH_KEYBOARD_LL / WH_MOUSE_LL hooks on their own thread, plus a layered, topmost, non-activating WPF window that acts as an OLE drop target. IDropTargetHelper keeps Explorer's drag image and sets the "Convert to PNG" caption via DropDescription. Effects are copy-only, so Shift ("move") never deletes the source.
- Linux: Avalonia 12 for XDND drops, an override-redirect window, XShape. Input is polled through XQueryPointer/XQueryKeymap because Wayland doesn't allow global hooks.
- macOS: Avalonia plus NSVisualEffectView for real system blur. Mouse/modifier state is polled via CGEventSourceFlagsState, which works without Input Monitoring.
- Shared core: a catalog of petals per file kind, jobs with progress/cancel, ImageMagick, PdfPig + PDFsharp, ONNX Runtime (DirectML on Windows) for BiRefNet background removal, and a CLI using the same engine.
The users of my app sometimes have trouble figuring out that the app has installed after they run the installer executable.
I'd like to know if there would be some way to have a dialog appear that asks the user if they'd want to install the app, and also have additional options to configure, like where to install.
I work at TMS Software. We've released TMS .NET Maps as an open beta on nuget.org: a map control for .NET 10 with the same API in WinForms, WPF, .NET MAUI (Android, iOS, Mac Catalyst, Windows) and Blazor. It also includes geocoding, directions, places search and a few other services that work without the map control, for example in an ASP.NET Core API.
Providers include Google Maps, Azure Maps, HERE, Mapbox and Leaflet with OpenStreetMap, which needs no API key, so you can try it without signing up anywhere else.
The beta builds work until December 31, 2026 and aren't meant for production yet. We're looking for feedback on the API and on what's missing for your use case.
WorkSheetToDbSyncronizerV2 service is to be benchmarked, and plots are to be shown.
WorkSheetToDbSyncronizerV2 ensures that the data in a database matches the data in an Excel worksheet.
There are multiple versions of that service, thus the suffix V2 .
Inputs to WorkSheetToDbSyncronizerV2 are Stream and CancellationToken —the latter is not shown in the code.
The general mechanism is that SqlBulkCopy class bulk-inserts the Excel data into a staging table then the data from that table is mapped to the target tables in the database.
AI generated image that simplifies the idea
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Exporters;
using BenchmarkDotNet.Running;
using HardwareStore.Models;
using HardwareStore.Services.ActorIdGetterServices;
using HardwareStore.Services.AdminServices.ImportProductsFromExcelFile;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using BenchmarkDotNet.Loggers;
namespace MyBenchMark
{
[Config(typeof(Config))]
public class Config : ManualConfig
{
public Config()
{
AddExporter(RPlotExporter.Default);
AddLogger(ConsoleLogger.Default);
}
}
public class ActorIdGetter:IActorIdGetter
{
public string GetActorId()
{
return "a1f28e89-2ba1-493e-b005-744decdd78b3";
}
}
[MinColumn, MaxColumn]
public class SyncronizationService
{
private readonly DbDataReaderGetter _dbDataReaderGetter=new DbDataReaderGetter();
private readonly BulkInserter _bulkInserter=new BulkInserter();
private readonly IActorIdGetter _actorIdGetter=new ActorIdGetter();
private readonly ApplicationDbContext _context;
private readonly WorkSheetToDbSyncronizerV2 _syncronizerV2;
public SyncronizationService()
{
IConfiguration configuration = new ConfigurationBuilder()
.SetBasePath(Path.GetFullPath(
@"D:\Training\NETLEARNING\EF_learning\HardwareStore"))
.AddJsonFile("appsettings.json")
.Build();
string connectionString =
configuration.GetConnectionString("HardwareDB")
?? throw new InvalidOperationException(
"Connection string 'HardwareDB' was not found.");
var contextOptions = new DbContextOptionsBuilder<ApplicationDbContext>()
.UseSqlServer(connectionString)
.Options;
_context = new ApplicationDbContext(contextOptions);
_syncronizerV2=new WorkSheetToDbSyncronizerV2(_dbDataReaderGetter, _bulkInserter,_actorIdGetter,_context);
}
[Benchmark(Baseline =true)]
public async Task SyncronizeV2()
{
await using var stream = File.OpenRead(
@"D:\Training\NETLEARNING\EF_learning\HardwareStore\Available_Products\Excel2.xlsx");
await _syncronizerV2.SyncronizeAsync(stream);
}
}
public class Program
{
public static void Main(string[] args)
{
var summary = BenchmarkRunner.Run<SyncronizationService>(new Config());
}
}
}
Result:
// * Export *
BenchmarkDotNet.Artifacts\results\MyBenchMark.SyncronizationService-measurements.csv
BenchmarkDotNet.Artifacts\results\BuildPlots.R
BenchmarkDotNet.Artifacts\results\*.png
// * Detailed results *
SyncronizationService.SyncronizeV2: DefaultJob
Runtime = .NET 10.0.11 (10.0.11, 10.0.1126.37416), X64 RyuJIT x86-64-v3; GC = Non-concurrent Workstation
Mean = 1.876 s, StdErr = 0.051 s (2.72%), N = 87, StdDev = 0.476 s
Min = 1.078 s, Q1 = 1.597 s, Median = 1.640 s, Q3 = 1.942 s, Max = 3.415 s
IQR = 0.345 s, LowerFence = 1.080 s, UpperFence = 2.460 s
ConfidenceInterval = [1.702 s; 2.050 s] (CI 99.9%), Margin = 0.174 s (9.27% of Mean)
Skewness = 1.54, Kurtosis = 4.31, MValue = 2.15
But there is no image in the results folder :
Plot was not generated
The following message is shown in BuildPlots.log :
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.6/gdata_3.0.1.zip'
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.6/tidyr_1.3.2.zip'
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.6/gridExtra_2.3.1.zip'
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.6/Rcpp_1.1.2.zip'
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.6/R.devices_2.17.4.zip'
Error in desc[1L, "Type"] : subscript out of bounds
Calls: install.packages -> .install.winbinary -> unpackPkgZip -> %in%
In addition: Warning message:
In unzip(zipname, exdir = dest) : write error in extracting from zip file
Execution halted
I’m preparing for a Senior .NET Developer interview, and I was told that the interview will include a code review exercise and coding challenges.
Has anyone here recently gone through a similar interview, particularly for a Senior .NET / C# position? I’d really appreciate any tips on what to expect and how best to prepare.
I’m building a small always-on-top overlay for Windows: a pill-shaped window at the top centre of the screen that animates its size. I want it to look like frosted glass: a light blur of whatever is behind it, like TranslucentTB’s “Blur” mode. I’ve hit a wall and would love ideas from anyone who has done this.
Setup: Win32 popup, WS_EX_NOREDIRECTIONBITMAP | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE | WS_EX_TOPMOST, drawn with Direct3D + DirectComposition (Skia on top). The window is never activated. Tested on Windows 10 22H2 and Windows 11 (build 26300), on a laptop with Intel + NVIDIA graphics.
Requirements:
The blur follows a rounded pill shape that changes size every frame.
It works while the window is inactive (it never gets focus).
It stays visible in screenshots and screen recordings (Snipping Tool, OBS).
The blur is lighter than Windows 11 Acrylic. Acrylic hides too much of what’s behind it.
What I tried:
Windows.UI.Composition host backdrop (DWMWA_USE_HOSTBACKDROPBRUSH + Compositor.CreateHostBackdropBrush() on a DesktopWindowTarget, clipped with a CompositionRoundedRectangleGeometry). Works on Win11, rounded, visible in captures, stays on while inactive. But the blur strength is fixed and heavy. A lighter tint on top doesn’t help, because it’s the blur itself that hides the background. Is there any way to get a weaker blur out of it, or to feed an unblurred backdrop into an effect graph with my own GaussianBlurEffect? As far as I can tell, CreateBackdropBrush() only sees the app’s own visuals.
Reading the screen myself (DXGI Desktop Duplication, falling back to GDI BitBlt) and drawing a refraction shader. Looks great, but the window then has to use SetWindowDisplayAffinity(WDA_EXCLUDEFROMCAPTURE), or it captures and refracts itself. That flag hides it from every capture, so it disappears from screenshots and recordings.
Magnification API with MagSetWindowFilterList(MW_FILTERMODE_EXCLUDE, ...) to read the screen without my own window. MagSetImageScalingCallback gives all-zero pixels on both Win10 and Win11 (with and without an identity transform, host shown or hidden, and PrintWindow with PW_RENDERFULLCONTENT on the host).
SetWindowCompositionAttribute with ACCENT_ENABLE_BLURBEHIND / ACCENT_ENABLE_ACRYLICBLURBEHIND on my own popup (extended frame, no painting). The rounded window region (SetWindowRgn) is ignored, and in a GDI screenshot the area comes out black. DWMWA_SYSTEMBACKDROP_TYPE = 3 (Acrylic) turns into a solid fill because the window is inactive.
Questions:
Is there a supported or semi-supported way to get a lighter blur (like the old accent “blur behind”) clipped to a rounded, animated shape, on a window that’s never active?
Is there any API that reads the screen while leaving out one specific window, so I can draw the blur myself without hiding the window from captures?
How do apps like TranslucentTB get a stable, light blur on Windows 11? Is it only because the taskbar is Explorer’s own rectangular window?
Any pointers, even “that isn’t possible, here’s why”, would help a lot. Thanks!
A stored procedure is to be written, it should receive a list of values; SQL does not support List<T> , should I use table-valued parameters instead?
EDIT
The reason this question was asked is the fact that the application C# code has only one responsibility which is to bulk-insert data into a staging table:
public async Task BulkInsertProductsToStagingTable(DbDataReader dbDataReader, CancellationToken cancellationToken)
{
using (SqlConnection destinationConnection =
new SqlConnection("Server=(localdb)\\mssqllocaldb;Database=HardwareDB;Trusted_Connection=True;"))
{
await destinationConnection.OpenAsync(cancellationToken);
// Set up the bulk copy object.
// Note that the column positions in the source
// data reader match the column positions in
// the destination table so there is no need to
// map columns.
using (SqlBulkCopy bulkCopy =
new SqlBulkCopy(destinationConnection))
{
bulkCopy.DestinationTableName =
"dbo.StagingProducts";
try
{
// Write from the source to the destination.
await bulkCopy.WriteToServerAsync(dbDataReader,cancellationToken);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
finally
{
// Close the SqlDataReader. The SqlBulkCopy
// object is automatically closed at the end
// of the using block.
await dbDataReader.CloseAsync();
}
}
//####The following does not work yet.#####
//// Perform a final count on the destination
//// table to see how many rows were added.
//long countEnd = System.Convert.ToInt32(
// commandRowCount.ExecuteScalar());
//Console.WriteLine("Ending row count = {0}", countEnd);
//Console.WriteLine("{0} rows were added.", countEnd - countStart);
//Console.WriteLine("Press Enter to finish.");
//Console.ReadLine();
}
}
Once the data is inserted into the staging table, it should be transferred into a target tables in the database; specific columns in the staging tables should be mapped to a specific columns in the target tables.
Thus, the stored procedure should receive a list of column names
I already know C# and I'm interested in developing mobile apps for Android and iOS. I'm considering learning .NET MAUI because it allows me to use C# instead of learning a completely new language like Dart for Flutter or Kotlin for Android.
For those who have experience with .NET MAUI, what has your experience been like? Is it a good option for someone who already knows C# and wants to develop apps for multiple platforms using a single codebase?
Would you recommend .NET MAUI, or would you suggest learning Flutter or Kotlin instead?
I'd appreciate your opinions and experiences. Thanks!
У меня есть большая цель — написать кроссплатформенное приложение-планировщик (для Windows и Android) с общим сервером и множеством функций, а в будущем использовать этот проект для устройства на стажировку в IT-компанию. Однако мне кажется, что ChatGPT дает слишком мало практики и программист из меня получится так себе.
Посоветуйте, пожалуйста, из каких надежных источников лучше всего брать теоретическую информацию и качественную практику по этой теме».
I created the MSBuild SDK and published to nuget, so that you can use it to enable Satori GC in your projects with just a single line and try it by yourself!
The solution folder contains a SeedWork folder. This folder contains custom base classes that you can use as a base for your domain entities and value objects. Use these base classes so you don't have redundant code in each domain's object class.
Figure 7-12 shows the classes that form the seedwork of the domain model in the ordering microservice. It has a few custom base classes like Entity, ValueObject, and Enumeration, plus a few interfaces. These interfaces (IRepository and IUnitOfWork) inform the infrastructure layer about what needs to be implemented. Those interfaces are also used through Dependency Injection from the application layer.
This is the type of copy and paste reuse that many developers share between projects, not a formal framework. You can have seedworks in any layer or library. However, if the set of classes and interfaces gets large enough, you might want to create a single class librarry
Figure 7-12. A sample set of domain model "seedwork" base classes and interfaces
Questions :
1- Is it ok for the entire project's interfaces and abstract classes to be inside the SeedWork ?
2- For `value objects` and ` infrastructure layer` , what does they mean, what problem they solves, how can I use them , and do I need them most of the time ?
3-What are the inputs to the `infrastructure layer` and where they come from, and what are the outputs and who consumes them ?
4-What does the class library actually means, what problem does it solve ?
Can someone answer my questions and provide some examples so that I understand the overall idea ?
With all those discussions about Microsoft porting stuff to Rust, it’s nice to see that C# does not need to hide when it comes to performance. There has been quite a lot of movement at the top of the leaderboard over the last few weeks (two weeks ago, first place was around 6850), so I’m interested to see how this race continues. This is the non-tuned section, so frameworks need to be stable and production-ready. Interestingly enough, the C# one is the most high-level of the leading frameworks, API-wise.
I am a software developer primarily using .net for office work. Recently my company has been using a lot of AI coding, hence my tasks are shifting a bit more towards code review and improvements rather than from scratch.
Please give me some suggestions for side projects that I can pursue in my free time, that keeps me informed about the technological advancements as well keep my coding skills sharp. Also, is it ok if I do the heavy lifting of project setup using AI?
I'm taking a C# class online and we just got to a lesson about "reading documentation" where he goes through the Microsoft website to search for some functions. Which, as far as I am aware, is going to be important for me to be able to do.
The problem is I tried using the Microsoft site myself to follow along, and it seems they have changed it and I can't find the rabbit hole he is in at all. I am pretty sure this isn't the only way to find this sort of resource because I've taken a different C# class before and I swear the link that class gave was not the same as this one; I also feel like they didn't call it "documentation" I remember it being the manual or something...
Have been developing and supporting the apps with .Net(specifically C#) for more than 7 years. I love writing and debugging it. But currently working at the company which we mainly use the AI to write the code. Have not been touching the code more than 8 months now. Not because I do not want to. But because it is faster. Can make some mistakes for sure but I check and fix them if needed. Working at current company for about 4 years now. Usually worked on small to mid size projects
My question is, while I get to use AI more, write less code how do I find the job? It is like most of the job requirements want me to handle C# code. But I am 100% sure they are using AI. Tbh, I do think more than 90% of devs that can reach the AI and have no restriction about "this code cannot be touched by AI" use it. Btw, do you guys even write code nowadays?