public T this[int index] { get { if (index < 0 || index >= length()) { throw new System.ArgumentOutOfRangeException(); } Transaction outer = current_(); Transaction inner = startRead_(outer); org.objectfabric.TArrayVersion <T> version = (org.objectfabric.TArrayVersion <T>)getVersionN_(inner, index); T value = version != null ? (T)version.get(index) : default(T); endRead_(outer, inner); return(value); } set { if (index < 0 || index >= length()) { throw new System.ArgumentOutOfRangeException(); } object asObject = (object)value; if (IS_TOBJECT) { if (asObject != null && ((org.objectfabric.TObject)asObject).resource() != resource()) { wrongResource_(); } } else if (CAN_BE_TOBJECT) { if (asObject is org.objectfabric.TObject && ((org.objectfabric.TObject)asObject).resource() != resource()) { wrongResource_(); } } Transaction outer = current_(); Transaction inner = startWrite_(outer); org.objectfabric.TArrayVersion <T> version = (org.objectfabric.TArrayVersion <T>)getOrCreateVersion_(inner); version.setBit(index); version.set(index, value); endWrite_(outer, inner); } }
protected internal override org.objectfabric.TObject.Version createVersion_() { org.objectfabric.TArrayVersion <T> version = new org.objectfabric.TArrayVersion <T>(0); version.setObject(this); return(version); }