You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.2 KiB
76 lines
2.2 KiB
<?xml version="1.0"?> |
|
<Template author="Justin Dearing" version="1.1"> |
|
|
|
<Config |
|
name = "${res:Templates.File.Struct.Name}" |
|
icon = "C#.File.NewClass" |
|
category = "C#" |
|
defaultname = "Struct${Number}.cs" |
|
language = "C#"/> |
|
|
|
<Description>${res:Templates.File.Struct.Description}</Description> |
|
|
|
<!-- |
|
Special new file templates: |
|
${StandardNamespace} -> Standardnamespace of the current project or FileNameWithoutExtension |
|
${FullName} -> Full generated path name |
|
${FileName} -> File name with extension |
|
${FileNameWithoutExtension} -> File name without extension |
|
${Extension} -> Extension in the form ".cs" |
|
${Path} -> Full path of the file |
|
${ClassName} -> Struct name (generally FileNameWithoutExtension w/o 'bad' characters) |
|
--> |
|
<Files> |
|
<File name="${FullName}" language="C#"><![CDATA[${StandardHeader.C#} |
|
using System; |
|
|
|
namespace ${StandardNamespace} |
|
{ |
|
/// <summary> |
|
/// Description of ${ClassName}. |
|
/// </summary> |
|
public struct ${ClassName} : IEquatable<${ClassName}> |
|
{ |
|
int member; // this is just an example member, replace it with your own struct members! |
|
|
|
#region Equals and GetHashCode implementation |
|
// The code in this region is useful if you want to use this structure in collections. |
|
// If you don't need it, you can just remove the region and the ": IEquatable<${ClassName}>" declaration. |
|
|
|
public override bool Equals(object obj) |
|
{ |
|
if (obj is ${ClassName}) |
|
return Equals((${ClassName})obj); // use Equals method below |
|
else |
|
return false; |
|
} |
|
|
|
public bool Equals(${ClassName} other) |
|
{ |
|
// add comparisions for all members here |
|
return this.member == other.member; |
|
} |
|
|
|
public override int GetHashCode() |
|
{ |
|
// combine the hash codes of all members here (e.g. with XOR operator ^) |
|
return member.GetHashCode(); |
|
} |
|
|
|
public static bool operator ==(${ClassName} left, ${ClassName} right) |
|
{ |
|
return left.Equals(right); |
|
} |
|
|
|
public static bool operator !=(${ClassName} left, ${ClassName} right) |
|
{ |
|
return !left.Equals(right); |
|
} |
|
#endregion |
|
} |
|
} |
|
]]></File> |
|
</Files> |
|
|
|
<AdditionalOptions/> |
|
</Template> |