Reputation: 19
using System;
namespace something
{
class Program
{
static void Main(string[] args)
{
int roomHeight = 10;
int roomLength = 10;
string Length;
for (int i=0; i < roomLength; i++)
{
Length = string.Join(Length, ("a"));
}
}
}
}
This doesn't compile, it does not recognize Length = string.Join(Length, ("a"));
I want it to recognize it as the string I declarated.
Upvotes: 0
Views: 105
Reputation: 176
using System;
namespace something
{
class Program
{
static void Main(string[] args)
{
int roomHeight = 10;
int roomLength = 10;
string length = string.Empty;
for (int i=0; i< roomLength; i++)
{
length= string.Join(length, ("a"));
}
}
}
}
Length needs to be assigned before you have it as a parameter in string.Join
Upvotes: 1