static void Main() { MyContainer <long> lContainer = new MyContainer <long>(); MyContainer <int> iContainer = new MyContainer <int>(); lContainer.Add(1); lContainer.Add(2); iContainer.Add(3); iContainer.Add(4); lContainer.Add(iContainer, EntryPoint.IntToLongConverter); foreach (long l in lContainer) { Console.WriteLine(l); } }
private void GenerateSquares() { float width = m_SquareSize * XCount; float height = m_SquareSize * YCount; m_Squares = new GridSquare[XCount, YCount]; for (int i = 0; i < XCount; i++) { for (int j = 0; j < YCount; j++) { Vector2 uL = new Vector2(i * m_SquareSize - (width / 2.0f), (j + 1) * m_SquareSize - (height / 2.0f)); Vector2 lR = new Vector2((i + 1) * m_SquareSize - (width / 2.0f), j * m_SquareSize - (height / 2.0f)); var square = (Instantiate(m_SquarePrefab, transform) as GameObject).GetComponent <GridSquare>(); var p = m_FreeSquares.Add(square); square.Init(i, j, p); square.Rect.Init(uL, lR); m_Squares[i, j] = square; if (IsPermiterSquare(square)) { PlaceWall(square); } } } var c = Camera.main; c.aspect = (width - 4.0f * m_SquareSize) / (height - 4.0f * m_SquareSize); c.orthographicSize = 0.5f * height - 2.0f * m_SquareSize; }
public void TestMethod1() { var client = new Client(); // this does NOT work due to constraints var locationId = "location"; var container = new MyContainer { Location = locationId }; var content = new ContentA(); container.Add(content); client.DoSomething<MyContainer, ContentA>(container, content); Assert.AreEqual(locationId, content.Location); }
public static void Main(string[] args) { Person person1 = new Person(); person1.name = "Max"; person1.alter = 20; Frau frau1 = new Frau(); Mann mann1 = new Mann(); Person[] instanzenArray = new Person[3]; instanzenArray[0] = person1; instanzenArray[1] = frau1; instanzenArray[2] = mann1; MyContainer container = new MyContainer(); container.Add(instanzenArray); container.GetAt(0); foreach (Person instanz in instanzenArray) { Console.WriteLine(instanz.GetAnrede()); } }
public ContainerPointer OnSquareBecomesOccupied(GridSquare square) { m_FreeSquares.Remove(square.Node); return(m_OccupiedSquares.Add(square)); }