diff options
Diffstat (limited to 'src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs')
-rw-r--r-- | src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs index 9705b61148..3afd87ab12 100644 --- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs +++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs @@ -13,7 +13,7 @@ using System.Security; namespace System.Runtime.InteropServices.WindowsRuntime { - internal sealed class CLRIReferenceImpl<T> : CLRIPropertyValueImpl, IReference<T>, IGetProxyTarget + internal sealed class CLRIReferenceImpl<T> : CLRIPropertyValueImpl, IReference<T>, IGetProxyTarget { private T _value; @@ -24,7 +24,8 @@ namespace System.Runtime.InteropServices.WindowsRuntime _value = obj; } - public T Value { + public T Value + { get { return _value; } } @@ -55,16 +56,16 @@ namespace System.Runtime.InteropServices.WindowsRuntime internal static Object UnboxHelper(Object wrapper) { Contract.Requires(wrapper != null); - IReference<T> reference = (IReference<T>) wrapper; - Debug.Assert(reference != null, "CLRIReferenceImpl::UnboxHelper - QI'ed for IReference<"+typeof(T)+">, but that failed."); + IReference<T> reference = (IReference<T>)wrapper; + Debug.Assert(reference != null, "CLRIReferenceImpl::UnboxHelper - QI'ed for IReference<" + typeof(T) + ">, but that failed."); return reference.Value; } } // T can be any WinRT-compatible type internal sealed class CLRIReferenceArrayImpl<T> : CLRIPropertyValueImpl, - IGetProxyTarget, - IReferenceArray<T>, + IGetProxyTarget, + IReferenceArray<T>, IList // Jupiter data binding needs IList/IEnumerable { private T[] _value; @@ -77,10 +78,11 @@ namespace System.Runtime.InteropServices.WindowsRuntime _value = obj; - _list = (IList) _value; + _list = (IList)_value; } - public T[] Value { + public T[] Value + { get { return _value; } } @@ -109,7 +111,8 @@ namespace System.Runtime.InteropServices.WindowsRuntime // IList & ICollection methods. // This enables two-way data binding and index access in Jupiter // - Object IList.this[int index] { + Object IList.this[int index] + { get { return _list[index]; @@ -120,30 +123,30 @@ namespace System.Runtime.InteropServices.WindowsRuntime _list[index] = value; } } - + int IList.Add(Object value) { return _list.Add(value); } - + bool IList.Contains(Object value) { return _list.Contains(value); } - + void IList.Clear() { _list.Clear(); } - bool IList.IsReadOnly - { + bool IList.IsReadOnly + { get { return _list.IsReadOnly; } } - + bool IList.IsFixedSize { get @@ -156,17 +159,17 @@ namespace System.Runtime.InteropServices.WindowsRuntime { return _list.IndexOf(value); } - + void IList.Insert(int index, Object value) { _list.Insert(index, value); } - + void IList.Remove(Object value) { _list.Remove(value); } - + void IList.RemoveAt(int index) { _list.RemoveAt(index); @@ -176,9 +179,9 @@ namespace System.Runtime.InteropServices.WindowsRuntime { _list.CopyTo(array, index); } - + int ICollection.Count - { + { get { return _list.Count; @@ -186,15 +189,15 @@ namespace System.Runtime.InteropServices.WindowsRuntime } Object ICollection.SyncRoot - { + { get { return _list.SyncRoot; } } - + bool ICollection.IsSynchronized - { + { get { return _list.IsSynchronized; @@ -205,7 +208,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime { return (object)_value; } - + // We have T in an IReferenceArray<T>. Need to QI for IReferenceArray<T> with the appropriate GUID, call // the get_Value property, allocate an appropriately-sized managed object, marshal the native object // to the managed object, and free the native method. @@ -238,7 +241,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime Type type = obj.GetType(); if (type.IsArray) - return CreateIReferenceArray((Array) obj); + return CreateIReferenceArray((Array)obj); if (type == typeof(int)) return new CLRIReferenceImpl<int>(PropertyType.Int32, (int)obj); @@ -313,7 +316,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime Contract.Ensures(Contract.Result<Object>() != null); Type type = obj.GetType().GetElementType(); - + Debug.Assert(obj.Rank == 1 && obj.GetLowerBound(0) == 0 && !type.IsArray); if (type == typeof(int)) |