是否可以将System.DayOfWeek的值直接转换为Microsoft.Office.Interop.Outlook.OlDaysOfWeek的值。就像是:



var day = DayOfWeek.Friday;
OlDaysOfWeek days = ConvertToDaysOfWeek(day);

最佳答案

要在不使用字符串操作的情况下执行此操作,请使用以下选项:

public OlDaysOfWeek ConvertToDaysOfWeek(DayOfWeek day)
{
    return (OlDaysOfWeek)Math.Pow(2, (int)day);
}

关于c# - 将System.DayOfWeek转换为Microsoft.Office.Interop.Outlook.OlDaysOfWeek,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55706483/

10-10 23:27