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

◆ GetNullabilityInfo() [2/2]

NullabilityInfo System.Reflection.NullabilityInfoContext.GetNullabilityInfo ( MemberInfo memberInfo,
Type type,
IList< CustomAttributeData > customAttributes,
int index )
inlineprivate

Definition at line 277 of file NullabilityInfoContext.cs.

278 {
280 NullabilityInfo elementType = null;
281 NullabilityInfo[] array = Array.Empty<NullabilityInfo>();
282 Type type2 = type;
283 if (type.IsValueType)
284 {
285 type2 = Nullable.GetUnderlyingType(type);
286 if (type2 != null)
287 {
288 state = NullabilityState.Nullable;
289 }
290 else
291 {
292 type2 = type;
293 state = NullabilityState.NotNull;
294 }
295 }
296 else
297 {
299 {
301 }
302 if (type.IsArray)
303 {
305 }
306 }
307 if (type2.IsGenericType)
308 {
309 Type[] genericArguments = type2.GetGenericArguments();
310 array = new NullabilityInfo[genericArguments.Length];
311 int i = 0;
312 int num = 0;
313 for (; i < genericArguments.Length; i++)
314 {
315 Type type3 = Nullable.GetUnderlyingType(genericArguments[i]) ?? genericArguments[i];
316 if (!type3.IsValueType || type3.IsGenericType)
317 {
318 num++;
319 }
321 }
322 }
323 NullabilityInfo nullabilityInfo = new NullabilityInfo(type, state, state, elementType, array);
324 if (!type.IsValueType && state != 0)
325 {
327 }
328 return nullabilityInfo;
329 }
NullabilityInfo GetNullabilityInfo(MemberInfo memberInfo, Type type, IList< CustomAttributeData > customAttributes)
static bool ParseNullableState(IList< CustomAttributeData > customAttributes, int index, ref NullabilityState state)
void TryLoadGenericMetaTypeNullability(MemberInfo memberInfo, NullabilityInfo nullability)
NullabilityState GetNullableContext(MemberInfo memberInfo)

References System.array, System.elementType, System.Reflection.NullabilityInfoContext.GetNullabilityInfo(), System.Reflection.NullabilityInfoContext.GetNullableContext(), System.Nullable< T >.GetUnderlyingType(), System.index, System.Reflection.NullabilityInfoContext.ParseNullableState(), System.state, System.Reflection.NullabilityInfoContext.TryLoadGenericMetaTypeNullability(), and System.type.