I'm new to C#, so forgive this noobish question. I'm playing with a simple XNA game demo. I have a struct that I want to be available to several classes. It is defined as follows:
PhotonType.cs
using System;
namespace ShipDemo
{
public struct PhotonType {
public Color tint;
}
}
In another file in the same folder/namespace, Ship.cs, I reference this struct:
namespace ShipDemo {
public class Ship {
//...
private PhotonType photonType;
//...
public Ship(float x, float y, float ang, Boolean correctSound, PhotonType photonType) {
//...
}
}
This gives me compilation errors on both references to PhotonType.
Error 1 The type or namespace name 'PhotonType' could not be found (are you missing a using directive or an assembly reference?)
What am I doing wrong here?
////
Also, the C# documentation says
It is an error to initialize an instance field in a struct.
But what if I want to provide default values?
I'm using Visual Studio Ultimate 2010 Beta.