c#

How to solve the example correctly?

Please help me solve the example correctly. and it is better to explain how. Create an array of 5 float numbers. Using th ... ht. so please advice on how to do it correctly and if possible with an explanation in simple language for a beginner. thanks.

How do I get its text when selecting a value in ComboBox?

How do I get its text when selecting a value in ComboBox? SelectedValue, Selecteditem does not help. And how do I add multiple values to a ComboBox without adding the same ones?

How to work with WinAPI

Hello. Do not tell me how to work with WimApi in C# (in a console application or forms) I want to use such a dll function so ... se I have never encountered the work of WinAPI, but I can not imagine how it should look. Thank you in advance for your help.

Process synchronization and messaging without blocking the thread by waiting

There is a code that tracks that only one instance of the application will be started. When you try to start a second instanc ... e?.Close(); } private static void OnApplicationExit(object sender, ExitEventArgs e) { DisableSingleInstanceWatcher(); }

Permutation cipher in C#

In permutation ciphers, the order of the characters changes. In a simple permutation cipher, a permutation of numbers from 0 ... указывать на позицию в строке. Имя параметра: length In the line msgInArray[i] = msg.Substring(i * key.Length, key.Length);

How do I make a dictionary for initializing sprites?

How to rewrite and use this GetSprite() under Dictionary<ItemType, Sprite>, so as not to use a separate field for each ... public Sprite BreadSprite; public Sprite FishSprite; public Sprite SteakSprite; public Sprite OnionSprite; }

Managed Code vs. Unmanaged when working with X86 Intrinsics

I learned that when working with intrinsiks in System.Runtime.Intrinsics.X86, it is not necessary to use pointers to address ... fe | Int32[1000] | 60.66 ns | 0.347 ns | 0.308 ns | | SumIntrinsicsHybrid | Int32[1000] | 61.01 ns | 0.418 ns | 0.370 ns |

How do I add a "jump" to a C# script on Unity 3D using Character Controller?

I made a script for moving a character in Unity with a smooth turn in 8 directions, but I don't know how to add a jump to the ... ation = Quaternion.Euler(0f, angle, 0f); controller.Move(direction * speed * Time.deltaTime); } } }

How do I save data in a WPF application?

1) How does saving in a WPF app work? i.e. what happens when I restart the app? Does everything start from zero, or does the ... everything starts from scratch. Is this normal, or am I doing something wrong? Maybe I have something wrong with the code?

How to use the Contains method correctly()

Hello! Tell me how to properly use LINQ, namely the Contains() method in this context: I have a list of strings. I have to p ... inside the loop: string substring = match.Value.ToString().Where(s => !s.Contains("\"MIP")); lst_policy2.Add(substring);

Is there an analog VB.Net the Strings.Format method in C#?

There is an old code in VB.Net, which is ported to C#. In the process, there was a problem with porting Strings. Format. The ... ring(); // Console.WriteLine(DateTime.Parse(dt).ToString(format, new VBDateTimeFormatProvider())); // выводит: "S12orA DaAe"

How to view features from user32.dll?

I tried it through DUMPBIN, but it returns "unable to open". A C# project, if that's important.

Wpf: binding data from an object

There is a separate class Piple with a bunch of data about a person, I create an object of this class in MainWinow. In the ma ... a from chel.name and chel.name2 to the corresponding textbox, respectively. Can you tell me if this can be done with Binding?

Changing the color in random positions in C#

Recently, I got a New Year's mood (mda in early December), I hope it will not disappear as usual at the end of the year. I ju ... rov) I added SetCursorPosition to my code, it turned out better, but how do I make it randomly put only in the filled fields?

Random selection of two phrases (words)

Tell me if there is any simple method of choosing from two phrases. For example, implementing such a Random r = new Random(); ... теплый"; break; } This code is too cumbersome, is there any reduction? For example: function(glass {warm|cold});

difference in throw, throw new, throw ex

What is the difference and why throw an exception at all? I understand that if we have a method called somewhere in which the ... potentially be an error, we should "throw" an exception from there to a place from where the method is not mediocre called,

C exception handling approach#

The question is more focused on an architectural approach or refactoring. For example, there is a console application where t ... like to know how to elegantly handle exceptions of asynchronous methods (asynh await), how to throw them to the main thread?

When compiling, the encoding is broken

Today, we changed the PC to a more powerful one. Installed the same version of Visual Studio (2015 Enterprise). But when comp ... coding is cp-1251. .Net Framework 3.5 There is a screen like this all.. It's not just the console that has this problem:

The Liskov substitution principle

Principle, describes 3 rules: Prerequisites cannot be reinforced in a subclass. By others in other words, subclasses sh ... 0-ok classes implements this interface => they can implement different behavior, since there is no initial implementation.

Find the sum of modules of negative odd elements

A two-dimensional 5×5 array is given. Find the sum of the modules of negative odd elements. I wrote the code and faced such a ... sum += Math.Abs(matrix[i, j]); } } Console.WriteLine($"{sum} ");