All Questions
17,707 questions
1
vote
1
answer
112
views
Marshaling an Array of Struct
I'm working with an unmanaged c++ dll in C# that controls a measuremnet device over USB. I got as far as getting single value measurement but I struggle trying to recover recorded data... I guess I ...
-1
votes
0
answers
54
views
Inputing values in an array with for loops problem [duplicate]
I am pretty much a begginer in C# and I am currently learning arrays and lists and I have a problem when I try to loop into an array (ex: for (.....){ students[i] = Console.ReadLine(); }).
It says on ...
-6
votes
1
answer
115
views
Why does C# allow for array creation with unknown size? [closed]
I am trying to understand why I am able to create a C# array without specifying the size at compile time. C# documentation mentions that you declare an array by specifying its size. In most array ...
0
votes
0
answers
38
views
C# Make Null-filled array be valid for any generic type [duplicate]
I have this code, which also compiles and works:
public partial class MeasurementInfoLabel : Label
{
/// <summary>
/// The two points clicked.
/// </summary>
public PointF?[...
-1
votes
2
answers
83
views
why does my data keeps the last element of previous array?
Hello Guys I'm new and trying to Make a RPG Text dialogue Style in Winforms.
you know the style which each char gets placed after another on.
but it keeps breaking
I have come so far:
using System;
...
0
votes
1
answer
36
views
gcAllowVeryLargeObjects is not effective for using more than 2GB in an array in C# Asp.NET
I have struct as following
public struct Data
{
public readonly long Start;
public readonly long End;
public Data(long start, long end)
{
Start = start;
End = end;
...
0
votes
0
answers
54
views
C# | Converting ushort[] to IEnumerable<object> doesnt work [duplicate]
To my situation:
Im reading with ManagementObjectSearcher objects and want to print them to a NameValueCollection (desriptor.Properties).
In order to achive this I need to iterate though every given ...
0
votes
3
answers
65
views
Convert Memory2D<T> to 1D array
I need simple way to convert Memory2D from CommunityToolkit.HighPerformance package into simple 1D collection-like form. List / Array / Anything like that 1D.
Best way i see by myself is MyMemory2D....
0
votes
0
answers
68
views
MongoDB C# GUID is not supported in Dictionary or its BUG Driver
I found a strange thing: when updating a document, if a field contains a Dictionary<GUID, *>, an exception occurs. I'm using driver version 3.1.0.
Code:
BsonSerializer.TryRegisterSerializer(new ...
0
votes
2
answers
104
views
C# ToArray conversion merged into one line with resulting array element change
I am wondering if it is possible to merge ToArray conversion with resulting array single element change into one statement.
This works perfectly
var response = Enumerable.Range(1, 5).Select(index =>...
2
votes
1
answer
48
views
MongoDB - Count number of object in array
I'm trying to perform a single request to find the length of an array in a MongoDB document.
In MongoDB, it can be done with an aggregation but to no success on my own.
db.mycollection.aggregate([{$...
0
votes
2
answers
99
views
C# range operator, why does this not throw an exception? (int x = someIntArray[2..2]) [closed]
int[] array = { 10, 20, 30, 40, 50 };
int[] range = array[2..2]; // gives empty array
int[] range2 = array[2..3]; // gives array with one element - 30
I understand range operators somewhat, like the ...
1
vote
1
answer
78
views
Function is not working, but gives no error
I'm new to C#. I'm trying to make game in Unity. These functions are necessary for changing in-game tabs with help of a button.
public string check;
public CanvasGroup hydrogenScreen;
public ...
0
votes
1
answer
66
views
error CS0847: An array initializer of length '120' is expected
I am trying to compare elements of array to variables, but I always get this error and I don't know what to do to fix it.
using System;
using System.Linq;
public string[] groups = new string[120] { &...
0
votes
2
answers
80
views
VB.net Hex to byte array translated to C#
Hey all I am getting the following error when running this code:
byte[] bytes = new[] {
Convert.ToByte("&H" + Conversion.Hex(127)),
Convert.ToByte("&H" + Conversion....