private static SerializableStructAttribute GetStructSerializationInfo(Type structType)
		{
			object[] attributes = structType.GetCustomAttributes(typeof(SerializableStructAttribute), true);

			if (attributes.Length == 0)
			{
				return null;
			}

			SerializableStructAttribute serializationAttribute = (SerializableStructAttribute)attributes[0];
			if (serializationAttribute.TargetType.IsPrimitive == false)
			{
				throw new NotSupportedException(string.Format(
								"The struct type {0} specifies an invalid target type in the SerializableStruct attribute", structType.FullName
								));
			}

			return serializationAttribute;
		}
		static MethodInfo GenerateWriteStructMethod(Type structType)
		{
			SerializableStructAttribute serializationAttribute = GetStructSerializationInfo(structType);
			MethodInfo method;

			if (serializationAttribute != null)
			{
				method = GetTypeMethod(serializationAttribute.TargetType, TypeMethodType.Serialize);
			}
			else
			{
				MethodInfo genericMethod = genericMethods[TypeMethodType.Serialize];
				method = genericMethod.MakeGenericMethod(new [] { structType });
			}

			if (method == null)
			{
				throw new NotSupportedException(string.Format(
									 "The struct type {0} cannot be serialized", structType.FullName
									 ));
			}

			return method;
		}