Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Questions tagged [c#]

C# (pronounced "see sharp") is a high level, object-oriented programming language that is designed for building a variety of applications that run on the .NET Framework (or .NET Core). C# is simple, powerful, type-safe, and object-oriented.

0
votes
0answers
4 views

Entity Framework Core Migrations In .NETSTANDARD Class Library?

The main issue: Need to update the SQL DB to have new tables because I added new Entities and DB sets in the DataAccess and Entity layers. Okay, my project is laid out like so. Solution > ...
0
votes
0answers
8 views

In my Xamarin.Forms if I catch an exception do I need to throw another exception in the catch block?

To help with debug in my application I have added a try catch to the MainPage class of my application. This gives me a decent view of problems when they come up: public MainPage() { ...
-1
votes
0answers
13 views

RSA Generate Public/Private Key By Using Master Key In C#

i'm trying to generate a public/private key for encryption by using a master key, i mean by master key is the user enter some dummy password like "a$3@90fK92" and each time when he tried to generate a ...
0
votes
1answer
22 views

How to secure files behind session?

I have links to static files that people can access in my application. However they can access these files without logging in. I'd like the static files to be behind login. How can I achieve this? ...
0
votes
0answers
6 views

Mahhaps - Show Dialog from library class

I use IDialogCoordinator on ViewModel and everything works fine. But if in viewmodel i have instance of other class, it doesn't work. I try to pass dialogCoordinator in constructor, but I've got a ...
0
votes
0answers
10 views

How do I Add Azure Functions at Run Time

I have a class library with methods that I want to map and execute as Azure Functions. How those methods should get mapped up (e.g. as timer, http trigger, what http verb or route to use, etc.) for ...
0
votes
0answers
7 views

ASP.NET List objects merging to bind into Dropdown

I am working on a project where I have two list objects and wou drop down list. C# objects List<CarsViewModel> CarsViewModelList = new List<CarsViewModelList>(); List<TrucksViewModel&...
0
votes
1answer
6 views

Unity Canvas Override Sorting Stuck On False

Very odd problem, I have a Canvas object and I am trying to set the overrideSorting flag to true. public void SetSortingLevel(string sortinglayerName) { _canvas.overrideSorting = true; ...
0
votes
0answers
15 views

Entity Framework select many-to-many with concat text

clases Book: Id, Name, Content, Publishment Author: Id,Name is many-to-many Book Id | Name | Content | Publishment 1 book1 somecontent some pub 2 book2 ...
0
votes
0answers
53 views

Random number keeps changing its numbers [on hold]

I was trying to create this "game" where the computer guesses a number between 1 to 100, and you have to input the number you guess, and it will say its guessed number is lower than what the user said ...
0
votes
0answers
3 views

MVC Forms Authentication Domain attribute breaks login in Firefox

I am attempting share authentication across multiple MVC web apps. The apps have different subdomains, e.g. x.example.com, y.example.com. I have generated a machine key and added it to the web.config ...
0
votes
0answers
10 views

How to abort thread invoked ShowDialog

Have C# Windows Forms application with secondary thread that receives requests from an external system to show or hide a form/dialog. I understand that secondary threads do not have a message loop ...
0
votes
0answers
9 views

FluentValidation how to create common part

I have an abstract (it's no matter) class: public abstract class CarrierAbstractFormAPI { public string Name { get; set; } public string Fein { get; set; } public string McNumber { get; ...
0
votes
1answer
11 views

UWP/C# Date Storage in a Variable

Now, ive bumped into so many different responses to the usage of Date in C# Ranging from using: DateTime.Parse Date.Now etc. There seems to me a huge amount of ways to use the time date funtion. ...
1
vote
0answers
9 views

MSMQ not sending message to server

I'm using MSMQ with WCF to send a message to a queue on a server. I'm setting up a proxy as a reference to the service, then making a call to that proxy. When executing, I receive the following error: ...
0
votes
0answers
7 views

Auto scroll down web browser in C# winforms programmatically

I need to autoscroll webbrowser automatically with code. I tried with this function but it didn't work: private void ScrollbrowserToTheend(WebBrowser br) { for (int i = 0; i ...
1
vote
0answers
17 views

Converting cURL command to RestSharp

I am trying to convert this curl command to RestSharp. curl -k -insecure "https://accounts.google.com/_/signin/sl/lookup?hl=tr^&_reqid=66671^&rt=j" -H "cookie: __utmx=173272373.NsRgTn8iQf-...
1
vote
0answers
5 views

Selenium/Specflow/C# - Make a base64 image open in another tab

So, I am currently using Specflow and Selenium to automate my QA. After each test, it generates an Extent Report and, when some error occours during the test, it takes a screenshot and puts the link ...
0
votes
0answers
29 views

Implement same interface in different projects

I have an API project and a class library project that contains interfaces. So I have a third project that implements interfaces and a project that implements the same interfaces of project 3. ...
0
votes
1answer
8 views

How to click on the button with text as Close within a modal dialog box as per the html through Selenium and C#

I am using Selenium Webdriver using C#, but selenium isn't identifying my Modal Window. I have tried: IAlert alert = driver.SwitchTo().Alert(); alert.Accept(); But it doesn't work. In the code ...
1
vote
0answers
12 views

Cross Process (and machine) Synchronization (Semaphores)

Background: My WCF application has to call a service that does not have any concurrency checking in it. It is a service created by a third party and getting them to add concurrency checking may not ...
-5
votes
1answer
37 views

Timer for whole ASP.NET project [on hold]

I'm working on a concert seat reservation project with C# ASP.NET & SQL Server. When someone selects a seat and fills the personal information it redirects to a bank to pay the price. At the ...
0
votes
1answer
3 views

Azure MachineLearning WebService Not Using Passed .ilearner Model

We are currently working on making an Azure MachineLearning Studio experiment operational. Our most recent iteration has a webjob that accepts a queue message, gets some data to train the model, and ...
1
vote
1answer
12 views

How can I change guilayout.label font size?

private void OnGUI() { GUIStyle myStyle = new GUIStyle(); myStyle.fontSize = 20; GUILayout.BeginVertical(GUI.skin.box); GUILayout.Label("Replacing"); GUI....
0
votes
0answers
28 views

Get transfer size with gzip of httpClient

I want to get the transfer size of httpClient instead of content length with gzip compression. At the moment, I have implemented a progress stream to count the size of the content and also the ...
0
votes
0answers
12 views

Get Cursor Object from Material Design in Xaml Icon Markup

I have a Material Design in XAML icon that I would like to use as a mouse cursor (for drag and drop purposes): I've obtained the corresponding XAML for this icon from https://materialdesignicons.com/ ...
-1
votes
2answers
20 views

How to load a C++ Native DLL with Mono

I'm writing a program for embedded linux on an ARM processor in .net that uses mono to execute. I have found that I can simply compile to either x86 or x64 architecture on my PC, copy the Debug ...
0
votes
0answers
34 views

c# how to convert char to VirtualKeyCode?

I've been looking over here, but usually question is other way roud "how to convert virtualkey to char". So I need to ask how to convert char into virtualkeycode? I can perfectly fine work with F1, ...
-5
votes
3answers
47 views

What's happenig behind the scene so the code returns 1 and not 43?

Found this in one book, but the explanation was too short. public class Program { int a = 0; private static void Main() { var val = new Program(); val.a += val.Foo(); ...
1
vote
0answers
19 views

Integrated Windows Authentication - Logout

I am attempting to use Integrated Windows Authentication on IIS for an MVC web app. The original hope was that the user would be logged in automatically using the current Windows user credentials. I ...
1
vote
0answers
14 views

Splitting Image Matrix into 16x16 Blocks

I have a matrix "width X heigth".I convert it from an image. Now i need to split this matrix into blocks(16x16).And check if it works. Now i've already done it but it didn't work. I don't know where ...
1
vote
0answers
14 views

Calling crypt32.dll CryptProtectData method from native code

I'm trying to call into the crypt32.dll method CryptProtectData from managed code, but I do not seem to have the marshaling types quite right in my delegate's declaration: [UnmanagedFunctionPointer(...
0
votes
1answer
15 views

Unity Script with an Update Function attached to multiple Objects

//GUI Function private void Update() { healthMeterPos.position = WorldToGuiPoint(new Vector2(position.xPos,position.yPos)); } This is my Update Function which is in a Parent class from which all ...
-1
votes
2answers
22 views

C# Find the Selected State of all items in a ListBox

I have found many examples on how to find the selected items in a listbox and how to iterate through a listbox; for(int index=0;index < listBox1.Items.Count; index++) { MessageBox.Show(...
0
votes
0answers
10 views

TabControl looses child controls

I am currently working on a just for fun solution for myself, to create workout plans for the gym. Solution on Github It is a simple WPF solution using Caliburn.Micro to easier get the connections ...
0
votes
0answers
14 views

Xamarin Plugin Geolocator not working on Xamarin Forms android

I have installed the following nuget: Xamarin.Forms.Maps Version => 3.1.0.697729 Plugin.CurrentActivity => 2.1.0.4 Xam.Plugin.Geolocator => 4.5.0.6 Plugin.Permissions => 3.0.0.12 I have the ...
0
votes
1answer
15 views

Web API: Download Multiple Files Separately

I have a Web Api controller method that gets passed document IDs and it should return the document files individually for those requested Ids. I have tried the accepted answer from the following link ...
0
votes
0answers
17 views

Does opening an external config file lock that config file to other applications

If I open a config file in the following way. Assume that path is set to the location of a web.config ExeConfigurationFileMap configFileMap = new ExeConfigurationFileMap(); configFileMap....
-2
votes
1answer
14 views

Although the internet page return a ok respond, this page takes a long time to load [on hold]

I'm writing an application that tests the login screen of a web site with a chromium web browser in c#. Naturally I manage my processes by filling in certain fields from website tags like ids, names ...
0
votes
0answers
42 views

Type of conditional expression cannot be determined as in c# [duplicate]

Can someone please look at the code below and tell me what I am doing wrong here. I am just trying to return a value based on some conditions but getting an error saying Type of conditional ...
-1
votes
0answers
14 views

Bad Request when PostAsJsonAsync

For some reason, I am getting bad request error while trying to PostAsJsonAsync or PutAsJsonAsync, (GetAsync and DeleteAsync works well). Information about httpresponsemessage, got while debuging ...
0
votes
1answer
33 views

How to import C# syntax colors from Visual Studio Code to Visual Studio?

I'd want to use Visual Studio Code's colors for C# (Omnisharp) in Visual Studio - How can I export them? Here's comparison:
1
vote
2answers
22 views

JArray - search for an object by key name

I have an object of type JArray, which contains a list of json objects. The JArray looks like: JArray jarray = [{"Key1":"v1"}, {"Key2":"v2"}, {"Key3":"v3"}] Now I want to retrieve an element from ...
-6
votes
1answer
48 views

Getting a list of classes that inherit a specific interface?

I'm using dependency injection in my project and wondered if it would be easier to just register all 30+ of my classes that inherit a certain interface using a for each, that way it works dynamically. ...
0
votes
0answers
15 views

Issue deploying ASP.net angular application to IIS

I am trying to deploy my application to IIS and everything seems to work however when I go to open up the web site I get the error below in the browser. I tried running it locally on the server its ...
0
votes
1answer
26 views

How to register all validators generically [duplicate]

I have a problem with dependency injection using open generic types. To register a validator now, I must write: container.RegisterType<IValidator<User>, UserValidator>(); I need ...
-1
votes
0answers
12 views

Split wav audio file depending upon start and end frames in c#

i struct somewhere to split the .wav audio file depending upon start and end frame which ll specified by parameter. Now i m able to divide the file. but result file is not playing anything. its empty....
0
votes
1answer
71 views

Remove the hidden characters from the string

I am trying to remove the mark up from the string like below string name = results[i].ToString(); var b = Regex.Replace(name, "<.*?>",string.Empty); String name looks like &lt;div class="...
0
votes
1answer
19 views

Web API WorkBook download

I have a Workbook using Microsoft.Office.Interop.Excel. My problem is this will be a API call and currently it works but saves to the server. Is there a way to have it download straight to the client ...
-1
votes
0answers
19 views

How do i update DataGrid XAML?

I cannot get my DataGrid to update with the data from my database. I created the database then added it in as a source to my WPF project then I dragged it in to my DataGrid. It automatically ...