Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ WriteDefaultIndexerInit()

string System.Xml.Serialization.ReflectionAwareCodeGen.WriteDefaultIndexerInit ( [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicEvents)] Type type,
string escapedName,
bool collectionUseReflection,
bool elementUseReflection )
inlineprivate

Definition at line 246 of file ReflectionAwareCodeGen.cs.

247 {
248 string text = GenerateVariableName("item", escapedName);
249 PropertyInfo defaultIndexer = TypeScope.GetDefaultIndexer(type, null);
250 _writer.Write("static XSArrayInfo ");
252 _writer.Write("= new XSArrayInfo(");
253 _writer.Write(GetStringForTypeof(CodeIdentifier.GetCSharpName(type), collectionUseReflection));
254 _writer.Write(".GetProperty(");
256 _writer.Write(",");
257 _writer.Write(GetStringForTypeof(CodeIdentifier.GetCSharpName(defaultIndexer.PropertyType), elementUseReflection));
258 _writer.Write(",new ");
260 _writer.WriteLine("{typeof(int)}));");
262 return text;
263 }
virtual void Add(object key, object? value)
Definition Hashtable.cs:676
string GetStringForTypeof(string typeFullName, bool useReflection)
static void WriteQuotedCSharpString(IndentedWriter writer, string value)
string GenerateVariableName(string prefix, string fullName)

References System.Xml.Serialization.ReflectionAwareCodeGen._reflectionVariables, System.Xml.Serialization.ReflectionAwareCodeGen._writer, System.Collections.Hashtable.Add(), System.Xml.Dictionary, System.FullName, System.Xml.Serialization.ReflectionAwareCodeGen.GenerateVariableName(), System.Xml.Serialization.CodeIdentifier.GetCSharpName(), System.Xml.Serialization.TypeScope.GetDefaultIndexer(), System.Xml.Serialization.ReflectionAwareCodeGen.GetStringForTypeof(), System.text, System.type, System.Xml.Serialization.IndentedWriter.Write(), System.Xml.Serialization.IndentedWriter.WriteLine(), and System.Xml.Serialization.ReflectionAwareCodeGen.WriteQuotedCSharpString().

Referenced by System.Xml.Serialization.ReflectionAwareCodeGen.InitTheFirstTime(), and System.Xml.Serialization.ReflectionAwareCodeGen.WriteCollectionInfo().