mardi 11 octobre 2016

Not able to get the Add method of a Type

I'm trying to get the Add method from a class that is defined as follows:

namespace Windows.UI.Xaml.Controls
{
  /// <summary>Provides access to an ordered, strongly typed collection of ColumnDefinition objects.</summary>
  [Threading(ThreadingModel.Both)]
  [MarshalingBehavior(MarshalingType.Agile)]
  [WebHostHidden]
  [ContractVersion(typeof (UniversalApiContract), 65536U)]
  public sealed class ColumnDefinitionCollection : IList<ColumnDefinition>, IEnumerable<ColumnDefinition>
  {
  }
}

As you see, it implements IList<ColumnDefinition> and IEnumerable<ColumnDefinition>

The strange thing is that using reflection I cannot get the Add method!

When I invoke typeof(ColumnDefinitionCollection).GetRuntimeMethods(), I get 31 methods, but NONE of them is the Add method.

I know it's there, but why is it hidden?

These are the methods I'm getting:

[0]: {Windows.UI.Xaml.Controls.ColumnDefinition GetAt(UInt32)}
[1]: {UInt32 get_Size()}
[2]: {System.Collections.Generic.IReadOnlyList`1[Windows.UI.Xaml.Controls.ColumnDefinition] GetView()}
[3]: {Boolean IndexOf(Windows.UI.Xaml.Controls.ColumnDefinition, UInt32 ByRef)}
[4]: {Void SetAt(UInt32, Windows.UI.Xaml.Controls.ColumnDefinition)}
[5]: {Void InsertAt(UInt32, Windows.UI.Xaml.Controls.ColumnDefinition)}
[6]: {Void RemoveAt(UInt32)}
[7]: {Void Append(Windows.UI.Xaml.Controls.ColumnDefinition)}
[8]: {Void RemoveAtEnd()}
[9]: {Void Clear()}
[10]: {UInt32 GetMany(UInt32, Windows.UI.Xaml.Controls.ColumnDefinition[])}
[11]: {Void ReplaceAll(Windows.UI.Xaml.Controls.ColumnDefinition[])}
[12]: {Windows.Foundation.Collections.IIterator`1[Windows.UI.Xaml.Controls.ColumnDefinition] First()}
[13]: {IntPtr GetRedirectedGetHashCodeMD()}
[14]: {Int32 RedirectGetHashCode(IntPtr)}
[15]: {Int32 GetHashCode()}
[16]: {IntPtr GetRedirectedToStringMD()}
[17]: {System.String RedirectToString(IntPtr)}
[18]: {System.String ToString()}
[19]: {IntPtr GetRedirectedEqualsMD()}
[20]: {Boolean RedirectEquals(System.Object, IntPtr)}
[21]: {Boolean Equals(System.Object)}
[22]: {System.Object GetData(System.Object)}
[23]: {Boolean SetData(System.Object, System.Object)}
[24]: {Void ReleaseAllData()}
[25]: {System.Object GetEventProvider(System.RuntimeType)}
[26]: {Int32 ReleaseSelf()}
[27]: {Void FinalReleaseSelf()}
[28]: {System.Type GetType()}
[29]: {Void Finalize()}
[30]: {System.Object MemberwiseClone()}





Aucun commentaire:

Enregistrer un commentaire