Akex
Akex
Explore posts from servers
CC#
Created by Akex on 5/15/2024 in #help
Object reference not set to an instance of an object.
root is an HtmlNode but when I try to access anything using SelectSingleNode or SelectNodes it will raise this error when trying to access any methods of them.
HtmlDocument doc = new();
doc.LoadHtml($"{url}/page/{page}/");

HtmlNode root = doc.DocumentNode;
Console.WriteLine(root.GetType());
Console.WriteLine(root.SelectSingleNode("//div").GetType());
HtmlDocument doc = new();
doc.LoadHtml($"{url}/page/{page}/");

HtmlNode root = doc.DocumentNode;
Console.WriteLine(root.GetType());
Console.WriteLine(root.SelectSingleNode("//div").GetType());
9 replies
CC#
Created by Akex on 10/24/2023 in #help
❔ Which types should I use for this dictionary
I am making a command interpreter from a game, which the players can use via /command <parameters>, each command can have different parameters, and different types for each parameter.
@Command(name="help",permission=Permission.User)
public void help(CommandContext context, Player player) {...}
@Command(name="help",permission=Permission.User)
public void help(CommandContext context, Player player) {...}
The only necessary parameter is context, player can be any other type, for example a string. So now I wanted to create a dictionary like { Player=PlayerConverter, Foo=FooConverter } which takes parameter type of the method, and converts it with the converter class from string to x. So the issue is that I do not know which types I need in the dictionary
8 replies