// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-//
-
-using System;
+#nullable enable
using System.StubHelpers;
using System.Reflection;
using System.Diagnostics;
-using System.Runtime.InteropServices;
using System.Collections;
using System.Collections.Generic;
-using System.Runtime.CompilerServices;
-using System.Security;
using Internal.Runtime.CompilerServices;
namespace System.Runtime.InteropServices.WindowsRuntime
// Creates a ICustomProperty implementation for Jupiter
// Called from ICustomPropertyProvider_GetProperty from within runtime
//
- internal static ICustomProperty CreateProperty(object target, string propertyName)
+ internal static ICustomProperty? CreateProperty(object target, string propertyName)
{
Debug.Assert(target != null);
Debug.Assert(propertyName != null);
// Creates a ICustomProperty implementation for Jupiter
// Called from ICustomPropertyProvider_GetIndexedProperty from within runtime
//
- internal static unsafe ICustomProperty CreateIndexedProperty(object target, string propertyName, TypeNameNative* pIndexedParamType)
+ internal static unsafe ICustomProperty? CreateIndexedProperty(object target, string propertyName, TypeNameNative* pIndexedParamType)
{
Debug.Assert(target != null);
Debug.Assert(propertyName != null);
- Type indexedParamType = null;
+ Type? indexedParamType = null;
SystemTypeMarshaler.ConvertToManaged(pIndexedParamType, ref indexedParamType);
return CreateIndexedProperty(target, propertyName, indexedParamType);
}
- internal static ICustomProperty CreateIndexedProperty(object target, string propertyName, Type indexedParamType)
+ internal static ICustomProperty? CreateIndexedProperty(object target, string propertyName, Type? indexedParamType)
{
Debug.Assert(target != null);
Debug.Assert(propertyName != null);
BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public,
null, // default binder
null, // ignore return type
- new Type[] { indexedParamType }, // indexed parameter type
+ new Type?[] { indexedParamType }, // indexed parameter type
null // ignore type modifier
);
//
// override ToString() to make sure callers get correct IStringable.ToString() behavior in native code
//
- public override string ToString()
+ public override string? ToString()
{
return WindowsRuntime.IStringableHelper.ToString(_target);
}
//
// IBindableVector implementation (forwards to IBindableVector / IVector<T>)
//
- object IBindableVector.GetAt(uint index)
+ object? IBindableVector.GetAt(uint index)
{
- IBindableVector bindableVector = GetIBindableVectorNoThrow();
+ IBindableVector? bindableVector = GetIBindableVectorNoThrow();
if (bindableVector != null)
{
// IBindableVector -> IBindableVector
{
get
{
- IBindableVector bindableVector = GetIBindableVectorNoThrow();
+ IBindableVector? bindableVector = GetIBindableVectorNoThrow();
if (bindableVector != null)
{
// IBindableVector -> IBindableVector
IBindableVectorView IBindableVector.GetView()
{
- IBindableVector bindableVector = GetIBindableVectorNoThrow();
+ IBindableVector? bindableVector = GetIBindableVectorNoThrow();
if (bindableVector != null)
{
// IBindableVector -> IBindableVector
_vectorView = vectorView;
}
- object IBindableVectorView.GetAt(uint index)
+ object? IBindableVectorView.GetAt(uint index)
{
return _vectorView.GetAt(index);
}
bool IBindableVector.IndexOf(object value, out uint index)
{
- IBindableVector bindableVector = GetIBindableVectorNoThrow();
+ IBindableVector? bindableVector = GetIBindableVectorNoThrow();
if (bindableVector != null)
{
// IBindableVector -> IBindableVector
void IBindableVector.SetAt(uint index, object value)
{
- IBindableVector bindableVector = GetIBindableVectorNoThrow();
+ IBindableVector? bindableVector = GetIBindableVectorNoThrow();
if (bindableVector != null)
{
// IBindableVector -> IBindableVector
void IBindableVector.InsertAt(uint index, object value)
{
- IBindableVector bindableVector = GetIBindableVectorNoThrow();
+ IBindableVector? bindableVector = GetIBindableVectorNoThrow();
if (bindableVector != null)
{
// IBindableVector -> IBindableVector
void IBindableVector.RemoveAt(uint index)
{
- IBindableVector bindableVector = GetIBindableVectorNoThrow();
+ IBindableVector? bindableVector = GetIBindableVectorNoThrow();
if (bindableVector != null)
{
// IBindableVector -> IBindableVector
void IBindableVector.Append(object value)
{
- IBindableVector bindableVector = GetIBindableVectorNoThrow();
+ IBindableVector? bindableVector = GetIBindableVectorNoThrow();
if (bindableVector != null)
{
// IBindableVector -> IBindableVector
void IBindableVector.RemoveAtEnd()
{
- IBindableVector bindableVector = GetIBindableVectorNoThrow();
+ IBindableVector? bindableVector = GetIBindableVectorNoThrow();
if (bindableVector != null)
{
// IBindableVector -> IBindableVector
void IBindableVector.Clear()
{
- IBindableVector bindableVector = GetIBindableVectorNoThrow();
+ IBindableVector? bindableVector = GetIBindableVectorNoThrow();
if (bindableVector != null)
{
// IBindableVector -> IBindableVector
}
}
- private IBindableVector GetIBindableVectorNoThrow()
+ private IBindableVector? GetIBindableVectorNoThrow()
{
if ((_flags & InterfaceForwardingSupport.IBindableVector) != 0)
return Unsafe.As<IBindableVector>(_target);
//
// IBindableVectorView implementation (forwarding to IBindableVectorView or IVectorView<T>)
//
- object IBindableVectorView.GetAt(uint index)
+ object? IBindableVectorView.GetAt(uint index)
{
- IBindableVectorView bindableVectorView = GetIBindableVectorViewNoThrow();
+ IBindableVectorView? bindableVectorView = GetIBindableVectorViewNoThrow();
if (bindableVectorView != null)
return bindableVectorView.GetAt(index);
else
{
get
{
- IBindableVectorView bindableVectorView = GetIBindableVectorViewNoThrow();
+ IBindableVectorView? bindableVectorView = GetIBindableVectorViewNoThrow();
if (bindableVectorView != null)
return bindableVectorView.Size;
else
bool IBindableVectorView.IndexOf(object value, out uint index)
{
- IBindableVectorView bindableVectorView = GetIBindableVectorViewNoThrow();
+ IBindableVectorView? bindableVectorView = GetIBindableVectorViewNoThrow();
if (bindableVectorView != null)
return bindableVectorView.IndexOf(value, out index);
else
IBindableIterator IBindableIterable.First()
{
- IBindableVectorView bindableVectorView = GetIBindableVectorViewNoThrow();
+ IBindableVectorView? bindableVectorView = GetIBindableVectorViewNoThrow();
if (bindableVectorView != null)
return bindableVectorView.First();
else
{ _iterator = iterator; }
public bool HasCurrent { get { return _iterator.HasCurrent; } }
- public object Current { get { return (object)_iterator.Current; } }
+ public object? Current { get { return _iterator.Current; } }
public bool MoveNext() { return _iterator.MoveNext(); }
}
- private IBindableVectorView GetIBindableVectorViewNoThrow()
+ private IBindableVectorView? GetIBindableVectorViewNoThrow()
{
if ((_flags & InterfaceForwardingSupport.IBindableVectorView) != 0)
return Unsafe.As<IBindableVectorView>(_target);