저는 첫 번째 주요 프로젝트에서 C#으로 작업 해 왔으며 동일한 솔루션에있는 다른 C# 클래스 파일과 해당 네임 스페이스를 참조하려고했습니다.네임 스페이스를 참조하는 C# XNA 사용
정확한 오류는 '유형 또는 네임 스페이스 이름'theNamespace '을 (를) 찾을 수 없습니다'주위를 둘러 보았고 내 문제를 해결하는 것이 발견되지 않았습니다. 다음은 오류가 감지 된 위치에 초점을 맞춘 내 현재 코드의 요약 된 버전입니다.
namespace TileMap
{
public class MapRow
{
public int TileMap()
{
for (int y=0; y<MapHeight; y++)
{ MapRow thisRow=new MapRow();
for (int x=0; x<MapWidth; x++){
thisRow.Columns.Add(new MapCell(0));
}
Row.Add(thisRow);
}}
public List<MapCell> Columns = new List<MapCell>();
public List<MapRow> Rows = new List<MapRow>();
public int MapWidth = 50;
public int MapHeight = 50;
}
}
및
namespace tiles
{
static class tile
{
static public Texture2D TileSetTexture;
static public Rectangle GetSourceRectangle(int tileindex)
{
return new Rectangle(tileindex * 32, 0, 32, 32);
}
}
}
어떤 제안 멋진 것 다음과 같이 내가 전화하려고 해요
using TileMap.MapRow.NET;
using tiles.tile.NET;
namespace Project
{
public class Class1 {
Tilemap.MapRow.TileMap myMap = new TileMap();
}
protected override void LoadContent() {
tile.tilesettexture=Content.Load<Texture2D>("@textures");
}
}
클래스입니다.
솔루션에 참조로 프로젝트를 추가 했습니까? –