Mono.CSharp.AnonymousMethodStorey.AddCapturedVariable C# (CSharp) Method

AddCapturedVariable() public method

public AddCapturedVariable ( string name, System.TypeSpec type ) : Field
name string
type System.TypeSpec
return Field
		public Field AddCapturedVariable (string name, TypeSpec type)
		{
			CheckMembersDefined ();

			FullNamedExpression field_type = new TypeExpression (type, Location);
			if (!IsGeneric)
				return AddCompilerGeneratedField (name, field_type);

			const Modifiers mod = Modifiers.INTERNAL | Modifiers.COMPILER_GENERATED;
			Field f = new HoistedField (this, field_type, mod, name, null, Location);
			AddField (f);
			return f;
		}

Usage Example

Example #1
0
		protected HoistedVariable (AnonymousMethodStorey storey, string name, TypeSpec type)
			: this (storey, storey.AddCapturedVariable (name, type))
		{
		}
All Usage Examples Of Mono.CSharp.AnonymousMethodStorey::AddCapturedVariable