// static factory method public static Platform[] GetPlatformIDs() { ErrorCode error; uint count; error = NativeMethods.clGetPlatformIDs(0, null, out count); if (error != ErrorCode.Success) { throw new OpenClException(error); } var ids = new IntPtr[count]; error = NativeMethods.clGetPlatformIDs(count, ids, out count); if (error != ErrorCode.Success) { throw new OpenClException(error); } var res = new Platform[count]; for (var i = 0; i < count; i++) { res[i] = new Platform(ids[i]); } return(res); }