Template:Code/var

From RimWorld Wiki
Jump to navigation Jump to search


Documentation icon Template documentation[view] [edit] [history] [purge]

Description[edit]

This template can be used to display a variable as in-line code, colorized. It is currently very specialized for Docs pages, and could be generalized. Suggestions are welcome.

All variable signatures will have a public visibility modifier.

Usage[edit]

{{code/fun | modifiers | is readonly | type | type link | variable name }}

if type link is . then it will link to type link. if type link is left empty, then it will not link.

At the moment, if is_readonly is not empty, it will display the readonly modifier. Just as a convention, I usually put get for getter properties, and ro for readonly variables.

Example Usage[edit]

E.g. Static modifier, readonly, no type link

{{code/var|static|ro|int||theMeaningOfLife}}

public static readonly int theMeaningOfLife;


E.g. A getter, links is the same as type name

{{code/var|virtual|get|Type|.|thing}}

public virtual readonly Type thing;


E.g. No modifier, Type is an Enum, so it links to the Enum page

{{code/var|||SomeEnum|Modding_Tutorials/Docs/Enums|category}}

public SomeEnum category;