什么是“使用???” 為了構建 GitHub > HDF.PInvoke > 食譜代碼片段,我需要放在 C# 類文件頂部的語句?例如,如果我將下面的食譜片段粘貼到 C# 類中,它不會構建,因為我假設沒有“使用”語句,并生成此錯誤:“目前的情況下不存在 H5A?!眕rivate bool ReadStringAttribute(hid_t objectId, string title, out string value){ value = ""; hid_t attributeId = 0; hid_t typeId = 0; try { attributeId = H5A.open(objectId, title); typeId = H5A.get_type(attributeId); var sizeData = H5T.get_size(typeId); var size = sizeData.ToInt32(); byte[] strBuffer = new byte[size]; var aTypeMem = H5T.get_native_type(typeId, H5T.direction_t.ASCEND); GCHandle pinnedArray = GCHandle.Alloc(strBuffer, GCHandleType.Pinned); H5A.read(attributeId, aTypeMem, pinnedArray.AddrOfPinnedObject()); pinnedArray.Free(); H5T.close(aTypeMem); value = System.Text.ASCIIEncoding.ASCII.GetString(strBuffer); return true; } catch (Exception ex) { return false; } finally { if (attributeId != null) H5A.close(attributeId); if (typeId != null) H5T.close(typeId); }}
1 回答

慕蓋茨4494581
TA貢獻1850條經驗 獲得超11個贊
這好像是
using HDF.PInvoke;
在這里查看單元測試用例
https://github.com/HDFGroup/HDF.PInvoke/tree/master/UnitTests/H5ATest
- 1 回答
- 0 關注
- 101 瀏覽
添加回答
舉報
0/150
提交
取消