Equivalent of JsonConstructor for serialization?
ASP.NET provides a handy JsonConstructor
annotation for deserializing a complex type from a string:
Do C# lambda functions create memory allocations?
I would like to make some heap allocation free methods for performing some operations. Some of these methods accept a delegate as their parameters. My concern is about what if passing in a lambda function to these methods would cause heap allocations. For example, consider the following code:
Read the csv file from local machine and delete them if certain keywords are present
As per my requirement, I download multiple files from server, and I am getting few csv files with below data inside.
check file exists on server or not using download url before downloading
I have url to download csv file. I want to check file exists or not before i download it. I did try using HttpWebRequest but it didnot work out. Am i doing anything wrong or is there better option to check file exists or not before download.
check file exists or not using download url before downloading
I have url to download csv file. I want to check file exists or not before i download it. I did try using HttpWebRequest but it didnot work out. Am i doing anything wrong or is there better option to check file exists or not before download.
reading cell values of excel
private static string GetCellValue(SpreadsheetDocument doc, Cell cell, ref List<ValidationResult> errors) { try{// If the cell does not exist, return an empty string.var result = string.Empty; if (cell == null || doc?.WorkbookPart?.SharedStringTablePart?.SharedStringTable == null) { return null; } if (cell.DataType != null && cell.DataType.Value == CellValues.SharedString) { var sharedStringTable = doc.WorkbookPart.SharedStringTablePart.SharedStringTable; if (int.TryParse(cell.CellValue?.InnerText, out int index) […]
What is the best/preferred way to dispose of all active threads in a windows service gracefully upon shutdown?
I am currently trying to decide between the two options below. I am using the Worker
class, which inherits from BackgroundService
. The way I see it, I have three options to handle cleaning up my windows service when a shutdown request is received:
How to add keys to Configuration which has multiple paths and Bind to Options
I need to add keys into Configuration for multi-tenants azure function while the function is executing.
For example :
How to add keys to Configuration which has multiple paths
I need to add keys into Configuration for multi-tenants azure function while the function is executing.
For example :
.net-is it possible to call WriteAsync multiple times at once?
I want to do something like this