<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
	<CodeSnippet Format="1.0.0">
		<Header>
			<Author>Robert MacLean - http://www.sadev.co.za</Author>
			<Description>Setups the framework for a struct - with the methods that the offical snippet skips.</Description>
			<HelpUrl>http://www.sadev.co.za</HelpUrl>
			<Keywords>
				<Keyword>C#</Keyword>
				<Keyword>struct</Keyword>
				<Keyword>GetHashCode</Keyword>
				<Keyword>Equals</Keyword>
				<Keyword>Equalality operator ==</Keyword>
				<Keyword>Inequalality operator !=</Keyword>
			</Keywords>
			<Shortcut>structc</Shortcut>
			<SnippetTypes>
				<SnippetType>Expansion</SnippetType>
			</SnippetTypes>
			<Title>Struct Complete</Title>
		</Header>
		<Snippet>
			<Declarations>
				<Literal>
					<ID>name</ID>
					<ToolTip>Struct name</ToolTip>
					<Default>MyStruct</Default>
				</Literal>
			</Declarations>
			<Code Language="CSharp">
				<![CDATA[
				/// <summary></summary>
				struct $name$
	{
		//TODO: Add properties, fields, constructors etc...
		
		/// <summary>
        /// Returns a hash code for this instance.
		/// </summary>
        /// <returns>
        /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. 
        /// </returns>
        public override int GetHashCode()
        {
            int valueStorage = 0;
            object objectValue = null;
            foreach (PropertyInfo property in typeof($name$).GetProperties())
            {
                objectValue = property.GetValue(this, null);
                if (objectValue != null)
                {
                    valueStorage += objectValue.GetHashCode();
                }
            }

            return valueStorage;
        }

        /// <summary>
        /// Determines whether the specified <see cref="System.Object"/> is equal to this instance.
        /// </summary>
        /// <param name="obj">The <see cref="System.Object"/> to compare with this instance.</param>
        /// <returns>
        /// 	<c>true</c> if the specified <see cref="System.Object"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(object obj)
        {
            if (!(obj is $name$))
                return false;

            return Equals(($name$)obj);
        }

        /// <summary>
        /// Equalses the specified other.
        /// </summary>
        /// <param name="other">The other.</param>
        /// <returns></returns>
        public bool Equals($name$ other)
        {
			//TODO: Implement check to compare two instances of $name$
			$selected$$end$
            return true;                
        }

        /// <summary>
        /// Implements the operator ==.
        /// </summary>
        /// <param name="first">The first.</param>
        /// <param name="second">The second.</param>
        /// <returns>The result of the operator.</returns>
        public static bool operator ==($name$ first, $name$ second)
        {
            return first.Equals(second);
        }

        /// <summary>
        /// Implements the operator !=.
        /// </summary>
        /// <param name="first">The first.</param>
        /// <param name="second">The second.</param>
        /// <returns>The result of the operator.</returns>
        public static bool operator !=($name$ first, $name$ second)
        {
            return !first.Equals(second);
        }
	}				
				]]>
			</Code>
		</Snippet>
	</CodeSnippet>
</CodeSnippets>