C
C#2y ago
Spekulant

❔ index out of range or non-negative

class find_path
{
public static int bfs(int[] start, int[] end,List<List<int>> board)
{
List<List<int>> Visited = new List<List<int>>();
Queue<List<int> > queue = new Queue<List<int>>();

Visited.Add(start.ToList());
queue.Enqueue(start.ToList());

while (queue.Count > 0)
{
var x = queue.Dequeue();
List<int[]> possiblePositions = new List<int[]>();
possiblePositions.Add(new int[] {x[0]-1, x[1], x[2]+1});
possiblePositions.Add(new int[] {x[0]-1, x[1]-1, x[2]+1});
possiblePositions.Add(new int[] {x[0]-1, x[1]+1, x[2]+1});
possiblePositions.Add(new int[] {x[0]+1, x[1]-1, x[2]+1});
possiblePositions.Add(new int[] {x[0]+1, x[1], x[2]+1});
possiblePositions.Add(new int[] {x[0]+1, x[1]+1, x[2]+1});
possiblePositions.Add(new int[] {x[0], x[1]+1, x[2]+1});
possiblePositions.Add(new int[] {x[0], x[1]-1, x[2]+1});

foreach (int[] position in possiblePositions)
{
if (position[0] > -1 && position[0] < 8 && position[1] > -1 && position[1] < 8)
{
if (board[position[0]][position[1]] == 2)
{
return position[2];
}
if (board[position[0]][position[1]] != 1)
{
if (!Visited.Contains(position.Take(2).ToList()))
{
queue.Enqueue(position.ToList());
Visited.Add(position.Take(2).ToList());
}
}
}
}
}

return -1;
}
}
class find_path
{
public static int bfs(int[] start, int[] end,List<List<int>> board)
{
List<List<int>> Visited = new List<List<int>>();
Queue<List<int> > queue = new Queue<List<int>>();

Visited.Add(start.ToList());
queue.Enqueue(start.ToList());

while (queue.Count > 0)
{
var x = queue.Dequeue();
List<int[]> possiblePositions = new List<int[]>();
possiblePositions.Add(new int[] {x[0]-1, x[1], x[2]+1});
possiblePositions.Add(new int[] {x[0]-1, x[1]-1, x[2]+1});
possiblePositions.Add(new int[] {x[0]-1, x[1]+1, x[2]+1});
possiblePositions.Add(new int[] {x[0]+1, x[1]-1, x[2]+1});
possiblePositions.Add(new int[] {x[0]+1, x[1], x[2]+1});
possiblePositions.Add(new int[] {x[0]+1, x[1]+1, x[2]+1});
possiblePositions.Add(new int[] {x[0], x[1]+1, x[2]+1});
possiblePositions.Add(new int[] {x[0], x[1]-1, x[2]+1});

foreach (int[] position in possiblePositions)
{
if (position[0] > -1 && position[0] < 8 && position[1] > -1 && position[1] < 8)
{
if (board[position[0]][position[1]] == 2)
{
return position[2];
}
if (board[position[0]][position[1]] != 1)
{
if (!Visited.Contains(position.Take(2).ToList()))
{
queue.Enqueue(position.ToList());
Visited.Add(position.Take(2).ToList());
}
}
}
}
}

return -1;
}
}
im pretty sure that im checking if it ok but i dont know what im doing wrong
83 Replies
Angius
Angius2y ago
Run the debugger, see if there actually is at least 3 elements in every list
Spekulant
SpekulantOP2y ago
i do not know how to do that ?
Spekulant
SpekulantOP2y ago
Spekulant
SpekulantOP2y ago
@Angius i get these erroes also error CS8804: Cannot specify /main if there is a compilation unit with top-level statements. Program.cs(3,1): error CS0103: The name 'Console' does not exist in the current context it wasnt
class find_path
{
public static int bfs(int[] start, int[] end,List<List<int>> board)
{
List<List<int>> Visited = new List<List<int>>();
Queue<List<int> > queue = new Queue<List<int>>();

Visited.Add(start.ToList());
queue.Enqueue(start.ToList());

while (queue.Count > 0)
{
var x = queue.Dequeue();
x.Add(0);
List<int[]> possiblePositions = new List<int[]>();
possiblePositions.Add(new int[] {x[0]-1, x[1], x[2]+1});
possiblePositions.Add(new int[] {x[0]-1, x[1]-1, x[2]+1});
possiblePositions.Add(new int[] {x[0]-1, x[1]+1, x[2]+1});
possiblePositions.Add(new int[] {x[0]+1, x[1]-1, x[2]+1});
possiblePositions.Add(new int[] {x[0]+1, x[1], x[2]+1});
possiblePositions.Add(new int[] {x[0]+1, x[1]+1, x[2]+1});
possiblePositions.Add(new int[] {x[0], x[1]+1, x[2]+1});
possiblePositions.Add(new int[] {x[0], x[1]-1, x[2]+1});

foreach (int[] position in possiblePositions)
{
if (position[0] > -1 && position[0] < 8 && position[1] > -1 && position[1] < 8)
{
if (board[position[0]][position[1]] == 2)
{
return position[2];
}
if (board[position[0]][position[1]] != 1)
{
if (!Visited.Contains(position.Take(2).ToList()))
{
queue.Enqueue(position.ToList());
Visited.Add(position.Take(2).ToList());
}
}
}
}
}

return -1;
}
}
class find_path
{
public static int bfs(int[] start, int[] end,List<List<int>> board)
{
List<List<int>> Visited = new List<List<int>>();
Queue<List<int> > queue = new Queue<List<int>>();

Visited.Add(start.ToList());
queue.Enqueue(start.ToList());

while (queue.Count > 0)
{
var x = queue.Dequeue();
x.Add(0);
List<int[]> possiblePositions = new List<int[]>();
possiblePositions.Add(new int[] {x[0]-1, x[1], x[2]+1});
possiblePositions.Add(new int[] {x[0]-1, x[1]-1, x[2]+1});
possiblePositions.Add(new int[] {x[0]-1, x[1]+1, x[2]+1});
possiblePositions.Add(new int[] {x[0]+1, x[1]-1, x[2]+1});
possiblePositions.Add(new int[] {x[0]+1, x[1], x[2]+1});
possiblePositions.Add(new int[] {x[0]+1, x[1]+1, x[2]+1});
possiblePositions.Add(new int[] {x[0], x[1]+1, x[2]+1});
possiblePositions.Add(new int[] {x[0], x[1]-1, x[2]+1});

foreach (int[] position in possiblePositions)
{
if (position[0] > -1 && position[0] < 8 && position[1] > -1 && position[1] < 8)
{
if (board[position[0]][position[1]] == 2)
{
return position[2];
}
if (board[position[0]][position[1]] != 1)
{
if (!Visited.Contains(position.Take(2).ToList()))
{
queue.Enqueue(position.ToList());
Visited.Add(position.Take(2).ToList());
}
}
}
}
}

return -1;
}
}
i added the x.add(0) and it helped with the index but its always printing 2 or -1 so i dont think like the generations and incrementing @Angius im beggin man im losing my fcking mind @Angius
class find_path
{
public static int bfs(int[] start, int[] end,List<List<int>> board)
{
List<List<int>> Visited = new List<List<int>>();
Queue<List<int> > queue = new Queue<List<int>>();


Visited.Add(start.Concat(new int[] { 0 }).ToList());
queue.Enqueue(start.Concat(new int[] { 0 }).ToList());

while (queue.Count > 0)
{
var x = queue.Dequeue();
List<int[]> possiblePositions = new List<int[]>();
possiblePositions.Add(new int[] {x[0]-1, x[1], x[2]+1});
possiblePositions.Add(new int[] {x[0]-1, x[1]-1, x[2]+1});
possiblePositions.Add(new int[] {x[0]-1, x[1]+1, x[2]+1});
possiblePositions.Add(new int[] {x[0]+1, x[1]-1, x[2]+1});
possiblePositions.Add(new int[] {x[0]+1, x[1], x[2]+1});
possiblePositions.Add(new int[] {x[0]+1, x[1]+1, x[2]+1});
possiblePositions.Add(new int[] {x[0]+0, x[1]+1, x[2]+1});
possiblePositions.Add(new int[] {x[0]+0, x[1]-1, x[2]+1});

class find_path
{
public static int bfs(int[] start, int[] end,List<List<int>> board)
{
List<List<int>> Visited = new List<List<int>>();
Queue<List<int> > queue = new Queue<List<int>>();


Visited.Add(start.Concat(new int[] { 0 }).ToList());
queue.Enqueue(start.Concat(new int[] { 0 }).ToList());

while (queue.Count > 0)
{
var x = queue.Dequeue();
List<int[]> possiblePositions = new List<int[]>();
possiblePositions.Add(new int[] {x[0]-1, x[1], x[2]+1});
possiblePositions.Add(new int[] {x[0]-1, x[1]-1, x[2]+1});
possiblePositions.Add(new int[] {x[0]-1, x[1]+1, x[2]+1});
possiblePositions.Add(new int[] {x[0]+1, x[1]-1, x[2]+1});
possiblePositions.Add(new int[] {x[0]+1, x[1], x[2]+1});
possiblePositions.Add(new int[] {x[0]+1, x[1]+1, x[2]+1});
possiblePositions.Add(new int[] {x[0]+0, x[1]+1, x[2]+1});
possiblePositions.Add(new int[] {x[0]+0, x[1]-1, x[2]+1});

this was my other attempt to like add the third value before hand but still nothing
Angius
Angius2y ago
$debug
MODiX
MODiX2y ago
Tutorial: Debug C# code - Visual Studio (Windows)
Learn features of the Visual Studio debugger and how to start the debugger, step through code, and inspect data in a C# application.
Angius
Angius2y ago
Check what x is
Spekulant
SpekulantOP2y ago
im not using visual studio
Angius
Angius2y ago
Then google how to use the debugger in whatever you're using Or Console.WriteLine() it
Spekulant
SpekulantOP2y ago
i did that and it stops in like 2 Xs dont know why
Angius
Angius2y ago
Well, one of them has fewer than 3 elements You can try safeguarding against it, for example
Spekulant
SpekulantOP2y ago
i mean if there is a way that i can do it differently
Angius
Angius2y ago
if (x.Length < 3)
{
Console.WriteLine("Less than 3 elements detected");
continue;
}
if (x.Length < 3)
{
Console.WriteLine("Less than 3 elements detected");
continue;
}
or some such
Spekulant
SpekulantOP2y ago
my x shoud contain like the x coord y coord and some num with number of steps to get there it was suggesting count to me
Angius
Angius2y ago
So use count, then
Spekulant
SpekulantOP2y ago
i did that with count and it didnt print anything
Angius
Angius2y ago
Also, did I get it right, that the list contains three different kinds of data? As in x[0] is the x coordinate, x[1] is the y coordinate, and x[2] is some number of steps?
Spekulant
SpekulantOP2y ago
well they are all ints yes
Angius
Angius2y ago
Use a class, then Not a list
Spekulant
SpekulantOP2y ago
well i dont know how to implement that i just rewrote it from python to c#
Angius
Angius2y ago
No better time to learn than now
Spekulant
SpekulantOP2y ago
but like what do you want me to do how should i use class for it
class find_path
{
public static int bfs(int[] start, int[] end,List<List<int>> board)
{
List<List<int>> Visited = new List<List<int>>();
Queue<List<int> > queue = new Queue<List<int>>();


Visited.Add(start.Concat(new int[] { 0 }).ToList());
queue.Enqueue(start.Concat(new int[] { 0 }).ToList());

while (queue.Count > 0)
{
var x = queue.Dequeue();
if (x.Count< 3)
{
Console.WriteLine("Less than 3 elements detected");
continue;
}
List<int[]> possiblePositions = new List<int[]>();
possiblePositions.Add(new int[] {x[0]-1, x[1], x[2]+1});
possiblePositions.Add(new int[] {x[0]-1, x[1]-1, x[2]+1});
possiblePositions.Add(new int[] {x[0]-1, x[1]+1, x[2]+1});
possiblePositions.Add(new int[] {x[0]+1, x[1]-1, x[2]+1});
possiblePositions.Add(new int[] {x[0]+1, x[1], x[2]+1});
possiblePositions.Add(new int[] {x[0]+1, x[1]+1, x[2]+1});
possiblePositions.Add(new int[] {x[0]+0, x[1]+1, x[2]+1});
possiblePositions.Add(new int[] {x[0]+0, x[1]-1, x[2]+1});
class find_path
{
public static int bfs(int[] start, int[] end,List<List<int>> board)
{
List<List<int>> Visited = new List<List<int>>();
Queue<List<int> > queue = new Queue<List<int>>();


Visited.Add(start.Concat(new int[] { 0 }).ToList());
queue.Enqueue(start.Concat(new int[] { 0 }).ToList());

while (queue.Count > 0)
{
var x = queue.Dequeue();
if (x.Count< 3)
{
Console.WriteLine("Less than 3 elements detected");
continue;
}
List<int[]> possiblePositions = new List<int[]>();
possiblePositions.Add(new int[] {x[0]-1, x[1], x[2]+1});
possiblePositions.Add(new int[] {x[0]-1, x[1]-1, x[2]+1});
possiblePositions.Add(new int[] {x[0]-1, x[1]+1, x[2]+1});
possiblePositions.Add(new int[] {x[0]+1, x[1]-1, x[2]+1});
possiblePositions.Add(new int[] {x[0]+1, x[1], x[2]+1});
possiblePositions.Add(new int[] {x[0]+1, x[1]+1, x[2]+1});
possiblePositions.Add(new int[] {x[0]+0, x[1]+1, x[2]+1});
possiblePositions.Add(new int[] {x[0]+0, x[1]-1, x[2]+1});
as you can see im adding it to queue
foreach (int[] position in possiblePositions)
{
if (position[0] > -1 && position[0] < 8 && position[1] > -1 && position[1] < 8)
{
if (board[position[0]][position[1]] == 2)
{
return position[2];
}
if (board[position[0]][position[1]] != 1)
{
if (!Visited.Contains(position.Take(2).ToList()))
{
queue.Enqueue(position.ToList());
Visited.Add(position.Take(2).ToList());
}
}
}
}
}

return -1;
}
}
foreach (int[] position in possiblePositions)
{
if (position[0] > -1 && position[0] < 8 && position[1] > -1 && position[1] < 8)
{
if (board[position[0]][position[1]] == 2)
{
return position[2];
}
if (board[position[0]][position[1]] != 1)
{
if (!Visited.Contains(position.Take(2).ToList()))
{
queue.Enqueue(position.ToList());
Visited.Add(position.Take(2).ToList());
}
}
}
}
}

return -1;
}
}
Angius
Angius2y ago
public class Whatever
{
public int X { get; }
public int Y { get; }
public int Steps { get; }
public Whatever(int x, int y, int steps)
{
X = x;
Y = y;
Steps = steps;
}
}
public class Whatever
{
public int X { get; }
public int Y { get; }
public int Steps { get; }
public Whatever(int x, int y, int steps)
{
X = x;
Y = y;
Steps = steps;
}
}
Spekulant
SpekulantOP2y ago
and then i go trough each one to check if it has the correct x y coords and i want to print the steps
Angius
Angius2y ago
And make it so that this is your x
Spekulant
SpekulantOP2y ago
so the class will be my list and i will add bunch of classes inside a queue
Angius
Angius2y ago
Yep
Spekulant
SpekulantOP2y ago
will the class return a list?
Angius
Angius2y ago
No, why would it? It describes one, self-contained object Not a list of things
Spekulant
SpekulantOP2y ago
well then i will check if whatever.whatever(x) is equal to x coord?
Angius
Angius2y ago
? whateverOne.X == whateverTwo.X That what you mean?
Spekulant
SpekulantOP2y ago
well my finish coordinates are the same so i will not put them in the class beacuse they dont change what you mean with the One and Two im just asking what will i write with this class to check the x value
Angius
Angius2y ago
whatever.X This will give you the value of X From an instance of Whatever named whatever
Spekulant
SpekulantOP2y ago
$get $get: i dont know what public int X { get; } public int Y { get; } public int Steps { get; } should do
Angius
Angius2y ago
Ah, now I know what you mean Thought you're trying to invoke some random bot commands Those are get-only properties $getsetdevolve
MODiX
MODiX2y ago
class Foo
{
private int _bar;

public int GetBar()
{
return _bar;
}

public void SetBar(int bar)
{
_bar = bar;
}
}
class Foo
{
private int _bar;

public int GetBar()
{
return _bar;
}

public void SetBar(int bar)
{
_bar = bar;
}
}
can be shortened to
class Foo
{
private int _bar;

public int GetBar() => _bar;

public void SetBar(int bar) => _bar = bar;
}
class Foo
{
private int _bar;

public int GetBar() => _bar;

public void SetBar(int bar) => _bar = bar;
}
can be shortened to
class Foo
{
private int _bar;
public int Bar {
get { return _bar; }
set { _bar = value; }
}
}
class Foo
{
private int _bar;
public int Bar {
get { return _bar; }
set { _bar = value; }
}
}
can be shortened to
class Foo
{
private int _bar;
public int Bar {
get => _bar;
set => _bar = value;
}
}
class Foo
{
private int _bar;
public int Bar {
get => _bar;
set => _bar = value;
}
}
can be shortened to
class Foo
{
public int Bar { get; set; }
}
class Foo
{
public int Bar { get; set; }
}
Angius
Angius2y ago
Lesser languages like Java need whole getter and setter methods C# has autoproperties
Anton
Anton2y ago
get; is like a readonly field
Spekulant
SpekulantOP2y ago
on so i just set that x coords is readonly field and they i set it
public class coords
{
public int X { get; }
public int Y { get; }
public int Steps { get; }
public int[] int_values(int x, int y, int steps)
{
X = x;
Y = y;
Steps = steps;
}
}
class find_path
{
public static int bfs(int[] start, int[] end,List<List<int>> board)
{

List<List<int>> Visited = new List<List<int>>();
Queue<List<int> > queue = new Queue<List<int>>();

Visited.Add(coords.int_values(start[0],start[1],0));
queue.Enqueue(coords.int_values(start[0],start[1],0));

while (queue.Count > 0)
{
var x = queue.Dequeue();
List<int[]> possiblePositions = new List<int[]>();
possiblePositions.Add(new int[] {x[0]-1, x[1], x[2]+1});
public class coords
{
public int X { get; }
public int Y { get; }
public int Steps { get; }
public int[] int_values(int x, int y, int steps)
{
X = x;
Y = y;
Steps = steps;
}
}
class find_path
{
public static int bfs(int[] start, int[] end,List<List<int>> board)
{

List<List<int>> Visited = new List<List<int>>();
Queue<List<int> > queue = new Queue<List<int>>();

Visited.Add(coords.int_values(start[0],start[1],0));
queue.Enqueue(coords.int_values(start[0],start[1],0));

while (queue.Count > 0)
{
var x = queue.Dequeue();
List<int[]> possiblePositions = new List<int[]>();
possiblePositions.Add(new int[] {x[0]-1, x[1], x[2]+1});
should i maybe do it like this well there is something wrong with non static and static but i have no idea also do i put int[] before int_values() ok well it is somehow working now but my last problem is
Angius
Angius2y ago
Your problem is the lack of C# knowledge, I'd say You said you're coming to C# from Python It'll be hard getting into an OOP language that has strict and static typing from a language where whatever goes as long as the indentation checks out I'd recommend learning about classes and stuff Besides that, you didn't follow the code I posted My code uses a constructor Yours has a random int_values method
Spekulant
SpekulantOP2y ago
Angius
Angius2y ago
Is that some online IDE?
Spekulant
SpekulantOP2y ago
yep that checks for test cases
Angius
Angius2y ago
Drop that shit like it's hot and install VS
Spekulant
SpekulantOP2y ago
no im using rider as im on mac but i write the code and put it on web that it checks if its correct
Angius
Angius2y ago
So why were you having issues with debugging? Rider has a great debugger Regardless Copy my code verbatim
Spekulant
SpekulantOP2y ago
Angius
Angius2y ago
Exactly how it is written
Spekulant
SpekulantOP2y ago
Spekulant
SpekulantOP2y ago
it works fine
Angius
Angius2y ago
Aight, if it works it works, then Problem solved
Spekulant
SpekulantOP2y ago
but dont know why it still has the
Angius
Angius2y ago
Idk either "Unhandled exception" is about useless as an error message can get
Spekulant
SpekulantOP2y ago
well dont know how to solve that will try uni discord why rider is not showing me this
Angius
Angius2y ago
No clue Would be easier to tell if this online thingamajig actually showed an error message
Spekulant
SpekulantOP2y ago
Angius
Angius2y ago
Dunno where you got it from, but if that is the error, it's quite a clear one
Spekulant
SpekulantOP2y ago
its not the devision by zero one its the one on a line 168
Angius
Angius2y ago
And that's the one I said is useless So We're not any closer to any solution Idk, maybe someone else will have some other ideas
Spekulant
SpekulantOP2y ago
only read this
you call a method on an uncreated object, infinite recursion, you access an array outside the bounds of that array, ...
bug
you call a method on an uncreated object, infinite recursion, you access an array outside the bounds of that array, ...
bug
Spekulant
SpekulantOP2y ago
Spekulant
SpekulantOP2y ago
maybe this warning that im getting
Angius
Angius2y ago
Possibly, yes Just declaring a variable doesn't mean it will have a value end_king for example, at this point, does not contain an array
Spekulant
SpekulantOP2y ago
public static int[] StartKing = new int[2];
public static int[] EndKing = new int[2];
public static int[] StartKing = new int[2];
public static int[] EndKing = new int[2];
did it like this
Angius
Angius2y ago
Sure, that will give them a value
Spekulant
SpekulantOP2y ago
do i also do the
namespace whatever{
main{
}
}
namespace whatever{
main{
}
}
or just
namespace whatver;
main{
}
namespace whatver;
main{
}
Angius
Angius2y ago
Nowadays, file-scoped namespaces (the second one) are valid and preferable But idk what version of .NET that online thingamajig uses
Spekulant
SpekulantOP2y ago
Spekulant
SpekulantOP2y ago
how can i edit this code so it doesnt have the errow
while (queue.Count > 0)
{
var x = queue.Dequeue();
List<int[]> possiblePositions = new List<int[]>();
possiblePositions.Add(new int[] { x.X - 1, x.Y, x.Steps + 1 });
possiblePositions.Add(new int[] { x.X - 1, x.Y - 1, x.Steps + 1 });
possiblePositions.Add(new int[] { x.X - 1, x.Y + 1, x.Steps + 1 });
possiblePositions.Add(new int[] { x.X + 1, x.Y - 1, x.Steps + 1 });
possiblePositions.Add(new int[] { x.X + 1, x.Y, x.Steps + 1 });
possiblePositions.Add(new int[] { x.X + 1, x.Y + 1, x.Steps + 1 });
possiblePositions.Add(new int[] { x.X + 0, x.Y + 1, x.Steps + 1 });
possiblePositions.Add(new int[] { x.X + 0, x.Y - 1, x.Steps + 1 });
while (queue.Count > 0)
{
var x = queue.Dequeue();
List<int[]> possiblePositions = new List<int[]>();
possiblePositions.Add(new int[] { x.X - 1, x.Y, x.Steps + 1 });
possiblePositions.Add(new int[] { x.X - 1, x.Y - 1, x.Steps + 1 });
possiblePositions.Add(new int[] { x.X - 1, x.Y + 1, x.Steps + 1 });
possiblePositions.Add(new int[] { x.X + 1, x.Y - 1, x.Steps + 1 });
possiblePositions.Add(new int[] { x.X + 1, x.Y, x.Steps + 1 });
possiblePositions.Add(new int[] { x.X + 1, x.Y + 1, x.Steps + 1 });
possiblePositions.Add(new int[] { x.X + 0, x.Y + 1, x.Steps + 1 });
possiblePositions.Add(new int[] { x.X + 0, x.Y - 1, x.Steps + 1 });
Angius
Angius2y ago
Those aren't errors, just warnings And it's telling you that you can use new[] { ... } instead of new int[] { ... } Also, ctrl+space in Rider will show you quick fixes
Spekulant
SpekulantOP2y ago
Spekulant
SpekulantOP2y ago
how i have this xd
Angius
Angius2y ago
Because you didn't write the code as I have written it, again new {} creates an anonymous object
Spekulant
SpekulantOP2y ago
class FindPath
{
private class Coordinates
{
public int X { get; }
public int Y { get; }
public int Steps { get; }

public Coordinates(int x, int y, int steps)
{
X = x;
Y = y;
Steps = steps;
}
}
class FindPath
{
private class Coordinates
{
public int X { get; }
public int Y { get; }
public int Steps { get; }

public Coordinates(int x, int y, int steps)
{
X = x;
Y = y;
Steps = steps;
}
}
ye i did it like this so you want me to just write new {} without anything in it?
Angius
Angius2y ago
The opposite Read what I said about the warning you were having Read it in full Character by character You will notice that I said
And it's telling you that you can use new[] { ... } instead of new int[] { ... }
and not
And it's telling you that you can use new { ... } instead of new int[] { ... }
Spekulant
SpekulantOP2y ago
Program.cs(54,21): warning CS8632: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context got this one this is new
Angius
Angius2y ago
You made something nullable with ? that can already be nullable by default
Spekulant
SpekulantOP2y ago
ye i got it
Angius
Angius2y ago
So... don't
Spekulant
SpekulantOP2y ago
but i was one of the quick fixes xd
Angius
Angius2y ago
Maybe Rider made the assumption that you have nullable reference types enabled, or it was just a suggestion ¯\_(ツ)_/¯
Spekulant
SpekulantOP2y ago
@Angius can i solve it somehow without system.Linq
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?