declaring a list of structs c# ?

Here’s my code:

using System;
using System.Collections;
using System.Collections.Generic;

public class AssemblerLibrary {

	private static List<AssemblerDefinition> _library = new List<AssemlerDefinition>();

	public static void Add (AssemblerDefinition def)
		_library.Add (def);

	public static Type GetAssembler(Component component)
		AssemblerDefinition def = _library.First(a => a.componentType == component.GetType() && a.segmentType == component.owner.GetType() && a.variation == component.owner.variation.amount);
		return def.assemblerType;


public struct AssemblerDefinition{
	public Type componentType;
	public Type segmentType;
	public int variation;
	public Type assemblerType;

	// constructor
	AssemblerDefinition(Type comp, Type seg, int vari, Type ass){
		componentType = comp;
		segmentType = seg;
		variation = vari;
		assemblerType = ass;


and here’s the error I get:

Assets/scripts/AssemblerLibrary.cs(7,70): error CS0246: The type or namespace name `AssemlerDefinition' could not be found. Are you missing a using directive or an assembly reference?

I tried moving the definition of the “AssemlerDefinition” struct around. I put it in the assemblerLibrary definition. I put it in its own name space and including it. But I still get this error. Is there something wrong with my syntax?

One thing is typo, the other thing is that the struct is public, but its constructor is not.

You constructor should be public.


AssemblerDefinition(Type comp, Type seg, int vari, Type ass)


public AssemblerDefinition(Type comp, Type seg, int vari, Type ass)

Typo “AssemlerDefinition” missing ‘b’

I can’t comment on the code/purpose, but you have typo from the error missing “b” in assembler