how to use interfaces and generics?

im trying to have

list<A> foo;

list<A> property()
{
get
{
return foo;
}
}


B inherits from A

class B : A
{
}

list<B> foo2;

override list<B> property2()
{
set
{
foo2 = value as list<B>;
}
}

basically i want

list to able to be returned in lieu of list

in the same way you can do

A foo()
{
get{};set{};
}

override B foo()
{
get{};
set{
B = A as B;
}
}

What you are describing in your (rather confusing) pseudocode can not be done. You are not allowed to change the return type of an overriden member, generic or not.

i figured it out I ended up doing

public abstract class Weapon<T> : MonoBehaviour where T : Projectile {
	List<T> _Projectiles;

	public virtual List<T> Projectiles
	{
		get
		{
			return _Projectiles;
		}
		set
		{
			_Projectiles = value;
		}
	}
}

then

public class BallisticWeapon : Weapon<BallisticProjectile> {
	//Number of Rounds of Ammunition
	int _Ammo;
	//Time in seconds to reload
	float _ReloadTime;
	float _Accuracy;
	List<BallisticProjectile> _BallisticProjectiles;

	public override List<BallisticProjectile> Projectiles {
		get {
			if(_BallisticProjectiles == null)
				Debug.Log("ERROR: " + this.gameObject.name + " NO PROJECTILE");
				
			return _BallisticProjectiles;
		}
		set {
			if(value is List<BallisticProjectile>)
			{
				_BallisticProjectiles = value as List<BallisticProjectile>;
				base.Projectiles = _BallisticProjectiles;
			}
		}
	}
}

my main issue is that it works but i still lack a strong understanding of generic classes and interfaces if anyone could suggest a good resource (MSDN didn’t do it for me)

i’d be grateful.