我有一个 if 语句,如果两个或多个条件 = true,我希望它为 true。我尝试使用 && 运算符,但 VS2012 只是抱怨说;
错误运算符“&&”不能应用于“bool”和“Microsoft.Exchange.WebServices.Data.DelegateFolderPermissionLevel”类型的操作数
我尝试了三种方法:
if (item.Permissions.CalendarFolderPermissionLevel != DelegateFolderPermissionLevel.Editor && item.Permissions.InboxFolderPermissionLevel != DelegateFolderPermissionLevel.Editor)
{
item.Permissions.CalendarFolderPermissionLevel = DelegateFolderPermissionLevel.Editor;
}
和
if (item.Permissions.CalendarFolderPermissionLevel && item.Permissions.InboxFolderPermissionLevel != DelegateFolderPermissionLevel.Editor)
{
item.Permissions.CalendarFolderPermissionLevel = DelegateFolderPermissionLevel.Editor;
}
和
if ((item.Permissions.CalendarFolderPermissionLevel = DelegateFolderPermissionLevel.Editor) && (item.Permissions.InboxFolderPermissionLevel != DelegateFolderPermissionLevel.Editor))
{
item.Permissions.CalendarFolderPermissionLevel = DelegateFolderPermissionLevel.Editor;
}
在网上找不到任何有用的东西。我将如何写这样的声明?它只适用于一个条件..