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

◆ GetStandardValues() [2/2]

override StandardValuesCollection System.ComponentModel.ReferenceConverter.GetStandardValues ( ITypeDescriptorContext? context)
inlinevirtualinherited

Reimplemented from System.ComponentModel.TypeConverter.

Definition at line 104 of file ReferenceConverter.cs.

105 {
106 List<object> list = null;
107 if (context != null)
108 {
109 list = new List<object> { null };
111 {
112 object[] references = referenceService.GetReferences(_type);
113 if (references != null)
114 {
115 for (int i = 0; i < references.Length; i++)
116 {
117 if (IsValueAllowed(context, references[i]))
118 {
119 list.Add(references[i]);
120 }
121 }
122 }
123 }
124 else
125 {
126 IContainer container = context.Container;
127 if (container != null)
128 {
129 ComponentCollection components = container.Components;
130 foreach (IComponent item in components)
131 {
132 if (item != null && _type != null && _type.IsInstanceOfType(item) && IsValueAllowed(context, item))
133 {
134 list.Add(item);
135 }
136 }
137 }
138 }
139 list.Sort(new ReferenceComparer(this));
140 }
141 return new StandardValuesCollection(list);
142 }
void Add(TKey key, TValue value)
virtual bool IsValueAllowed(ITypeDescriptorContext context, object value)
virtual bool IsInstanceOfType([NotNullWhen(true)] object? o)
Definition Type.cs:1020

References System.ComponentModel.ReferenceConverter._type, System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.ComponentModel.IContainer.Components, System.ComponentModel.ITypeDescriptorContext.Container, System.IServiceProvider.GetService(), System.Type.IsInstanceOfType(), System.ComponentModel.ReferenceConverter.IsValueAllowed(), System.item, and System.list.