本文整理匯總了C#中AccountInfo.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# AccountInfo.ToString方法的具體用法?C# AccountInfo.ToString怎麽用?C# AccountInfo.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AccountInfo
的用法示例。
在下文中一共展示了AccountInfo.ToString方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: MakeLocalPrincipalObject
/// <summary>
/// Create a <see cref="LocalPrincipal"/> object from information in
/// an AccountInfo object.
/// </summary>
/// <param name="info">
/// An AccountInfo object containing information about the account
/// for which the LocalPrincipal object is being created. This parameter
/// may be null, in which case this method returns null.
/// </param>
/// <returns>
/// A new LocalPrincipal object representing the account, or null if the
/// <paramref name="info"/> parameter is null.
/// </returns>
private LocalPrincipal MakeLocalPrincipalObject(AccountInfo info)
{
if (info == null)
return null; // this is a legitimate case
var rv = new LocalPrincipal(info.ToString());
rv.SID = info.Sid;
rv.PrincipalSource = GetPrincipalSource(info);
switch (info.Use)
{
case SID_NAME_USE.SidTypeAlias: //TODO: is this the right thing to do???
case SID_NAME_USE.SidTypeGroup:
case SID_NAME_USE.SidTypeWellKnownGroup:
rv.ObjectClass = Strings.ObjectClassGroup;
break;
case SID_NAME_USE.SidTypeUser:
rv.ObjectClass = Strings.ObjectClassUser;
break;
default:
rv.ObjectClass = Strings.ObjectClassOther;
break;
}
return rv;
}