Exemplo n.º 1
0
 internal static unsafe IList <ReplicaHealthState> FromNativeList(IntPtr nativeListPtr)
 {
     if (nativeListPtr != IntPtr.Zero)
     {
         var nativeList = (NativeTypes.FABRIC_REPLICA_HEALTH_STATE_LIST *)nativeListPtr;
         return(ReplicaHealthStateList.FromNativeList(nativeList));
     }
     else
     {
         return(new ReplicaHealthStateList());
     }
 }
        internal static unsafe ReplicaHealthStateList FromNativeList(
            NativeTypes.FABRIC_REPLICA_HEALTH_STATE_LIST *nativeList)
        {
            var retval = new ReplicaHealthStateList();

            var nativeItemArray = (NativeTypes.FABRIC_REPLICA_HEALTH_STATE *)nativeList->Items;

            for (int i = 0; i < nativeList->Count; ++i)
            {
                var nativeItem = *(nativeItemArray + i);
                var item       = ReplicaHealthState.FromNative(nativeItem);
                if (item != null)
                {
                    retval.Add(item);
                }
            }

            return(retval);
        }