LogRecord.Record 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取日志记录用户数据。
public:
property System::Object ^ Record { System::Object ^ get(); };
public object Record { get; }
member this.Record : obj
Public ReadOnly Property Record As Object
属性值
包含用户数据的单个 BLOB。
示例
下面的代码示例演示如何使用此属性。
public:
virtual bool AbortRecord(LogRecord^ log) override
{
// Check the validity of the record.
if (log == nullptr)
{
return true;
}
array<Object^>^ record = dynamic_cast<array<Object^>^>(log->Record);
if (record == nullptr)
{
return true;
}
if (record->Length != 2)
{
return true;
}
// Extract old account data from the record.
String^ filename = (String^) record[0];
int balance = (int) record[1];
// Restore the old state of the account.
WriteAccountBalance(filename, balance);
return false;
}
public override bool AbortRecord (LogRecord log)
{
// Check the validity of the record.
if (log == null) return(true);
Object[] record = log.Record as Object[];
if (record == null) return(true);
if (record.Length != 2) return(true);
// Extract old account data from the record.
string filename = (string) record[0];
int balance = (int) record[1];
// Restore the old state of the account.
AccountManager.WriteAccountBalance(filename, balance);
return(false);
}
Public Overrides Function AbortRecord(ByVal log As LogRecord) As Boolean
' Check the validity of the record.
If log Is Nothing Then
Return True
End If
Dim record As [Object]() = log.Record
If record Is Nothing Then
Return True
End If
If record.Length <> 2 Then
Return True
End If
' Extract old account data from the record.
Dim filename As String = CStr(record(0))
Dim balance As Integer = Fix(record(1))
' Restore the old state of the account.
AccountManager.WriteAccountBalance(filename, balance)
Return False
End Function 'AbortRecord