Summary
[Editor-Only] A variety of methods relating to procedurally generating C# code.
- Assembly
- Weaver
.dll - Namespace
- Weaver
.Editor .Procedural .Scripting - Base Types
-
- Object
graph BT
Type-->Base0["Object"]
Type["CSharpProcedural"]
class Type type-node
Syntax
public static class CSharpProcedural
Methods
Name | Value | Summary |
---|---|---|
AppendDeclaration |
void |
Appends the C# declaration of the specified access `modifiers` to the `text`.
static
|
AppendDefault |
void |
Appends "null" for classes or "default(type)" for structs.
static
|
AppendDefault |
void |
Appends "null" for classes or "default(T)" for structs.
static
|
AppendEndRegion |
void |
Indents the text by the specified amount and appends #endregion.
static
|
AppendForLoop |
void |
Appends the opening of a for loop: for (int i = 0; i < length; i++).
static
|
Append |
void |
Appends a call to the specified `methodName`. If the method is non-public, the object is casted to the
`interfaceType` to call an explicitly implemented method.
static
|
Append |
void |
Appends an [
System.ObsoleteAttribute ] with the specified message in its constructor.
If `message` is null, this method does nothing.
static
|
Append |
void |
Appends the C# declaration of a constructor with a signature matching the specified `constructor` and an [Obsolete] attribute.
The body of the constructor will simply throw a
System.NotImplementedException .
static
|
Append |
void |
Appends the C# declaration of a field with a signature matching the specified `field` and an [Obsolete] attribute.
If the field is static and
Weaver.Editor.Procedural.Scripting.CSharpProcedural.GetInitializer(System.Object) is able to determine the initializer for
its current value, that initializer will also be included.
static
|
Append |
void |
Appends the C# declaration of a member with a signature matching the specified `member` and an [Obsolete] attribute.
static
|
Append |
void |
Appends the C# declaration of a method with a signature matching the specified `method` and an [Obsolete] attribute.
The body of the method will simply throw a
System.NotImplementedException .
static
|
Append |
void |
Appends the C# declaration of a property with a signature matching the specified `property` and an [Obsolete] attribute.
The body of the property will simply throw a
System.NotImplementedException .
static
|
Append |
void |
Appends the C# declaration of a type with a signature matching the specified `type` and an [Obsolete] attribute.
Also calls
Weaver.Editor.Procedural.Scripting.CSharpProcedural.AppendObsoleteDeclaration(System.Text.StringBuilder,System.Int32,System.Reflection.MemberInfo,System.String,System.Boolean) for each of the type's members.
static
|
Append |
void |
Appends a method body which throws a
System.NotImplementedException .
static
|
AppendRegion |
void |
Indents the text by the specified amount and appends #region regionName.
static
|
Append |
void |
Appends `comment` inside summary tags as appropriate for a C# XML comment.
static
|
AppendStringLiteral |
void |
Appends the `literal` with escape characters inserted as necessary.
static
|
Append |
void |
Appends the full name of the given type with underscores instead of any characters that wouldn't be valid
in a symbol name.
static
|
Append |
void |
Appends and logs a message indicating that the specified `member` was not handled.
static
|
CloseScope |
void |
text.Indent(--indent).AppendLineConst("}"); static
|
CloseScopeFully |
void |
Appends closing brackets and new lines until the nestCount reaches 0.
static
|
Contains |
bool |
Returns true if `modifiers` contains all of the flags specified in `contains`.
static
|
GetDeclaration |
string |
Returns the C# declaration of the specified access `modifiers`.
static
|
GetInitializer |
string |
Tries to return a string which could be used as a C# field initializer to give the field the specified `value`.
Returns null if the 'value is null or if unable to determine the appropriate field initializer.
If the value is a custom type with a static string GetInitializer(T value) method, that method will be called to determine the result.
static
|
GetKeyword |
string |
Gets the C# keyword associated with the `modifier`.
static
|
Get |
AccessModifiers |
Returns the restrictiveness modifier (public/private/protected/internal) of the specified `method`.
static
|
HasModifiers |
bool |
Returns true if the specified `field` has the specified access `modifiers`.
static
|
HasModifiers |
bool |
Returns true if the specified `method` has the specified access `modifiers`.
static
|
HasModifiers |
bool |
Returns true if the specified `property` has the specified access `modifiers`.
static
|
HasModifiers |
bool |
Returns true if the specified `property` has the specified access `modifiers`.
static
|
HasModifiers |
bool |
Returns true if the specified `type` has the specified access `modifiers`.
static
|
IsValidInMemberName |
bool |
Checks if the specified char can be used in a C# symbol name.
static
|
OpenScope |
void |
text.Indent(indent++).AppendLineConst("{"); static
|
ToStringCS |
string |
Returns a string representation of the `value` as a C# literal: either "true" or "false" instead of the
uppercase forms returned by
System.Boolean.ToString .
static
|
ValidateMemberName |
string |
Converts the specified string into a valid member name by skipping any invalid characters or replacing them with underscores.
static
|
ValidateMemberName |
string |
Converts the specified sub-string into a valid member name by skipping any invalid characters or replacing them with underscores.
static
|