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

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

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

            return(retval);
        }