ObjectIDGenerator.HasId(Object, Boolean) 方法
定义
确定是否已经给对象分配 ID。Determines whether an object has already been assigned an ID.
public:
virtual long HasId(System::Object ^ obj, [Runtime::InteropServices::Out] bool % firstTime);
public virtual long HasId (object obj, out bool firstTime);
abstract member HasId : obj * bool -> int64
override this.HasId : obj * bool -> int64
Public Overridable Function HasId (obj As Object, ByRef firstTime As Boolean) As Long
参数
- obj
- Object
你所请求的对象。The object you are asking for.
- firstTime
- Boolean
如果 obj 先前对于 ObjectIDGenerator 未知,则为 true;否则为 false。true if obj was not previously known to the ObjectIDGenerator; otherwise, false.
返回
如果先前对于 ObjectIDGenerator 已知,则为 obj 的对象 ID;否则为零。The object ID of obj if previously known to the ObjectIDGenerator; otherwise, zero.
例外
obj 参数为 null。The obj parameter is null.
注解
如果已为该对象分配 ID,则返回该 ID 并将其 firstTime 设置为 false ; 否则,将返回零,并 firstTime 将设置为 true 。If the object has already been assigned an ID, the ID is returned and firstTime is set to false; otherwise, zero is returned and firstTime is set to true. HasId 与的不同之处在于, GetId 它永远不会为尚未显示的对象创建 ID ObjectIDGenerator 。HasId differs from GetId in that it never creates an ID for an object that has not already been seen by the ObjectIDGenerator.