// static factory methods public static Kernel CreateKernel(Program program, string name) { ErrorCode error; var handle = NativeMethods.clCreateKernel(program.handle, name, out error); if (error != ErrorCode.Success) { throw new OpenClException(error); } return(new Kernel(handle)); }