mambo no. 5
mambo no. 5
Explore posts from servers
CC#
Created by mambo no. 5 on 8/26/2023 in #help
❔ top level statements
i am using .net 7.0 with top level statements. Why does this work:
Multiply(2, 4);

partial class Program
{
static void Multiply(int num01, int num02)
{
int result = num01 * num02;
Console.WriteLine("The result is: " + result);
}
}
Multiply(2, 4);

partial class Program
{
static void Multiply(int num01, int num02)
{
int result = num01 * num02;
Console.WriteLine("The result is: " + result);
}
}
but not this:
partial class Program
{
static void Multiply(int num01, int num02)
{
int result = num01 * num02;
Console.WriteLine("The result is: " + result);
}
}

Multiply(2, 4);
partial class Program
{
static void Multiply(int num01, int num02)
{
int result = num01 * num02;
Console.WriteLine("The result is: " + result);
}
}

Multiply(2, 4);
Why does the latter throw an error "Can't resolve symbol 'Multiply'"?
18 replies