c#

How do virtual functions work in c#?

Is there even a concept of a virtual function table in sharpe? Let's say there is a class hierarchy, in the class at the top ... the table of virtual functions for structures works, since the methods are overridden. Thank you in advance for your answers

Passing a generic type to another method/function

I call another function from a generalized function, passing the generalized type there. The environment swears at the conver ... ; listDTO) { foreach(T ob in listDTO) { if (!IsValid(ob)) return false; } return true; }

Working with object[] and List object

List<object> list = new List<object>(); list.Add(new object[] { Convert.ToByte(1), Convert.ToInt32(10 ... he values from List object -> object [] - > for example the value of the string (I originally wrote the string " test")

Output of an array in C#

I came to C# from Python, and in Python, to output an array, I had to enter the following line: 'print (array)'. How to output an array in C#, without a loop?

Random. nextDouble and Random.Next don't work

public int RandomNumber(int min, int max) { Random random = new Random(); return random.Next(min, max); } Here the ... "Random" as the first argument (the using directive or assembly reference may have been omitted). Help. Thank you in advance

foreach() for enum

Can you tell me how to organize foreach() for enum elements? Example of what I want to do: public enum Fruits { Appl ... id EnumerateAllFruits() { foreach (Fruits fruit in Fruits) { DoSomething(fruit); } }

You need to sort the text file and separate the men from the women

There is a text file of the form: Иванов Иван Иванович Иванова Ольга Сергеевна Each person with a new line, I want to writ ... sorting methods, worked with them, but only with numbers, and I can't figure out how to sort strings. Who can tell you what?

How to overlay images in C#?

There is a PictureBox, a background image is loaded into it. You need to add a few more images on top, and they should not co ... s are the same size. Basically, I need to implement the ability to show different layers as in image editors. No ideas yet =(

Button ContextMenu Styling in wpf

I'm trying to assign a style to ContextMenu to make it look like the Discord interface In general, I am surprised by the whi ... t; </Setter.Value> </Setter> And this is it: What to do with the edges?

How do I specify the "Color" type?" in XAML WPF?

People, I need to specify a class in TargetType, not Color, but Color?. That is, a color that can have the value Null. Specify TargetType="Color" I can, but I can't specify TargetType="Color?". Can you tell me how to do this?

This release does not meet the Google Play requirements for 64-bit applications

When downloading the app in the Play Market, an error appears: This release does not meet the Google Play requirements fo ... ehold, there is a solution The first time it helped me , but then they started knocking out errors Here is my screen:

checking the convergence of the sum of a series with an accuracy of epsilon, C#

There is generally such a task. I am interested in whether it was solved correctly (the code below). It is not quite clea ... double sum = f; while (Math.Abs(f)>eps) { n++; f *= Math.Pow(x, n) / ((n + 2) * Math.Pow(2, n)); sum += f; }

Drawing lines via DrawLines C#

How can I implement rendering not through the main Paint event in winforms? Such a problem, when I draw in the standard Form1 ... e if (e.Button == MouseButtons.Right) rad = (circles[numberRectangle].Width / 2) + player.Width / 2; } } } `

How to determine the bit depth of the operating system by means of.NET?

There is a C# application for Win 7, during the execution of which you need to determine whether it is running on the 32 or 64 bit version of the OS. Is it possible to do this with .NET or is it necessary to use "workarounds"?

Where is the exe file of the C# program under Visual Studio?

The latest version of VS Community 2019 is delivered. I compile a simple console program. Actually, it is written everywhe ... , it is nowhere to be found. The program then runs in VS, but is executable the file is hidden somewhere. Question: where to?

Implementation of the algorithm of combinations without repetitions for N numbers of length in K

Let's say we have 6 numbers. 2 4 6 8 12 14. It is necessary to get all combinations of these numbers in the form of sums with ... 8 =..... I understand that these are combinations of combinatorics, but I don't know how to turn it into code. C#language;

How can I use ComboBox (WPF) to allow copying text from it to the clipboard?

There is a ComboBox described like this: <ComboBox ItemsSource="{Binding DatabaseItems}" SelectedItem="{Bindi ... ing an item from the list. How to achieve this effect while maintaining the ban on manual text input in the ComboBox? Thanks!

How to build a smoothly increasing graph?

I want to generate data for plotting a graph of the following type: I can easily build area 1 and 3, but I can't build area ... point where the curve should end the value of the derivative of the curve at the point x2 Plot a smoothly increasing curve?

The "TestDB" database requested by the login cannot be opened. Failed to log in

The "TestDB" database requested by the login cannot be opened. Failed to log in. An error occurred when logging in to the use ... ver=\SQLEXPRESS; Database=TestDB; Trusted_Connection=true; User Id = ; Password = ;" Microsoft.EntityFrameworkCore.SqlServer

Working with two Wpf MVVM monitors

You can tell me, here I have 2 monitors and I need to move the WPF window to another monitor by clicking the button and retur ... s = screen.Bounds; mWindow.Left = bounds.Left + mWindow.Left; mWindow.Top = bounds.Top + mWindow.Top; }