c# Unexpected symbol '=' in struct, class.....

I must be doing something wrong. I’m getting the error in the title, but I have no idea why. The error is on line 8 and 9 Here is my code:

public class ItemDatabase {
	private List<Item> items = new List<Item>();
	private Dictionary<string, Item> itemPresets = new Dictionary<string, Item>();
	Item preset;
	preset = new Item();
	preset.Name = "Rusty Sword";
	public void SetPreset(string name, Item preset) {
		itemPresets[name] = preset;
	public Item AddNew(string name) {
		Item preset = itemPresets[name];
		return preset;

Item is a class, with the property Name.

Also, the autocopmlete or whatever isn’t showing my variables, in case it has anything to do with this.
What am I doing wrong??


The following needs to be in a method.

 preset = new Item();
 preset.Name = "Rusty Sword";

If you need to have this be predefined you need to modify Item to have a constructor that accepts a name and do the following:

Item preset = new Item("Rusty Sword");