Content
EF Core 6 - Truncate Table
Hi, How can I use the truncate table in EF Core 6? I tried this but didn't delete rows. _oyunPalasContext.RazerReconciliation.FromSqlRaw("TRUNCATE TABLE RazerReconciliation");


How to use C# Linq to find average value of a double list.
Hello: I have the following data: List<double[]> asks = new(); var ask1 = new[] { 4.0, 4.0 }; var ask2 = new[] { 5.0, 5.0 }; asks.Add(ask1); asks.Add(ask2); List<double[]> bids = new(); var bid1 = new[] { 3.0, 3.0 }; var bid2 = new[] { 2.0,…
Best way to unit test cancellation
Good evening. I have been trying to write a unit test that will test the cancellation of a method. Now I have a unit test written that passes, but I am do not think it is what I am looking to achieve. I have tried a few different ways to achieve the…


Why is the combo box cursor/caret moves to the beginning when down arrow is hit?
In my app I have a combo box <ComboBox ItemsSource="{Binding ComboItems}" SelectedItem="{Binding SelectedCBItem}" StaysOpenOnEdit="True" Text="{Binding SelectedCBItem,…


filter & save to xml function doesnt work viewmodel
Hello Morning: First i read xml file to fill the datagrid edit, save the xml file, then export the datagrid to excel file using OpenXML, then read the excel file to fille the datagrid. When i jsut read the xml file, i can filter the datagrid and edit…
Blazor Server - System.InvalidCastException: Unable to cast object of type 'System.Double' to type 'System.Single'.
Hi, In my Blazor server application, I am trying to get the records from RazerReconciliation table as follows. I couldn't figure out why I am getting this error. public async Task<List<RazerReconciliations>> GetOldReconsAsync() { var…
401 Unauthorized when Granting access via Azure AD App-Only
I followed this article but I modified the sample code a bit to use GetContextAsync instead of GetAzureADAppOnlyAuthenticatedContext AuthenticationManager authManager = new AuthenticationManager(clientId, certPath,certPassword,tenantId); using…


CollectionView UI not updated when Switch Toggled but ObservableCollection updated
Here, when toggle, observablecollection has been updated, but ui not updated. Expected Output is: When switch toggle is on, the items pack price need to be display. When switch toggle is off, the item's price need to be display. <CollectionView…


WPF ListBox - Display Message When Item Source Is Empty
Hello All - I am trying to replace the listbox with a message for the user when there is no data available. When there is data available, whatever is available, will display out. I have been working on this for a while but do not know what to do. When…


How to detect Windows Application Dark mode
What is the way to detect windows application dark mode setting (If it is dark or light), in a C# WPF application. Settings > Personalization > Colors > “Choose your default app mode” Screenshot from Windows 10 operating system. I am aware of…




C# code to check the first character in the string is an integer and then convert to hex if integer
In the input script, check the first character of the input parameter. If it is a digit value, then convert the integer to hex. For example input is 7fph7vfxbvkl then output becomes _x0037_fph7vfxbvkl .looking for a c# script for this Thank you


How do I add my company subscription Id?
Hi all, I would like to add my company Subscription ID to my subscriptions. Is that possible?


How to open or launch my desktop application(windows application) developed using C# in browser
I have to launch or open my desktop application developed using C# in the browser? please give me some suggestions on how to achieve it ? Thanks in advance. Explanation: I have a windows app XYZ.exe so I need to open this application from the browser. so…


InputTransparent not working on a BoxView?
It appears the InputTransparent is not working properly? I set it to false, yet any controls underneath still receive taps. <AbsoluteLayout VerticalOptions="Fill" BackgroundColor="#5774ED"> <ActivityIndicator…
using FileSystem.OpenAppPackageFileAsyn to open and play mp3 files stored on Google Drive
Hi I am using VS 2022 and C# to develop a MAUI App which needs to be deployed for IOS/Android and Windows. I would like to play audio files that are stored on Google Drive using audioPlayer. Can I use FileSystem.OpenAppPackageFileAsyn to open the file,…
Is it possible to show a hover highlight feature while dragging and dropping in C#?
My program has this code but it isn't coming together right. I'm wondering if this is even possible. ListViewItem prevSelected = null; private void List_MouseLeave(object sender, EventArgs e) { if (prevSelected != null) …
How to search dictionary key and find the value in C#?
Hello: I have the following Json data stored into one dictionary: public class JsonKey { public int? Index { get; set; } public string? ID { get; set; } public string? Name { get; set; } …
How to use Json Data as dictionary key and find the value?
Hello: I have the following Json data stored into one dictionary: (newtonsoft.json) public class JsonKey { public int? Index { get; set; } public string? ID { get; set; } public string? Name { get; set;…
Unable to call handler in Razor page from JQuery
I'm trying to call a handler in my Razor code behind to bind a table and it's not getting executing. CS code: public async Task<JsonResult> OnGetCarList() { var cars = await _context.GetCars.ToListAsync(); return new…

