Without access to your full code, we can't help much - a small fragment like that in isolation doesn't help much because the error is pretty specific:
A namespace cannot directly contain members
But ... the most likely reason is you have put the method in the wrong place, and it's after the closing curly bracket for the class:
namespace MyNamespace
{
public class MyClass
{
...
}
public string HotelBlock(string RoomIndexs)
{
...
}
}
In C#, all fields, propertied, methods, delegates, events, -
everything - must be part of a class; if it isn't you ghet this error message.