本文整理汇总了C#中IUser.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# IUser.Clone方法的具体用法?C# IUser.Clone怎么用?C# IUser.Clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUser
的用法示例。
在下文中一共展示了IUser.Clone方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetUser
/// <summary>
/// Gets the user.
/// </summary>
/// <param name = "user">The user.</param>
/// <param name = "exists">IUser exists</param>
public void GetUser(ref IUser user, out bool exists)
{
User userCopy = (User)user.Clone();
IUser existingUser = _users.FirstOrDefault(t => t.Name == userCopy.Name && t.CardId == userCopy.CardId);
if (existingUser != null)
{
TvStoppedReason reason = user.TvStoppedReason;
user = (User)existingUser.Clone();
user.TvStoppedReason = reason;
exists = true;
return;
}
exists = false;
}
示例2: RequestCardReservations
public static ICollection<ICardTuneReservationTicket> RequestCardReservations(IUser user, IEnumerable<CardDetail> availCardsForReservation, TVController tvController, ICardReservation cardResImpl, IEnumerable<int> ignoreCards)
{
ICollection<ICardTuneReservationTicket> tickets = new List<ICardTuneReservationTicket>();
IDictionary<int, ITvCardHandler> cards = tvController.CardCollection;
foreach (CardDetail cardDetail in availCardsForReservation)
{
int idCard = cardDetail.Card.IdCard;
bool foundIgnoredCard = ignoreCards.Contains(idCard);
if (!foundIgnoredCard)
{
IUser userCopy = user.Clone() as User;
if (userCopy != null)
{
userCopy.CardId = idCard;
ITvCardHandler tvcard = cards[idCard];
ICardTuneReservationTicket ticket = cardResImpl.RequestCardTuneReservation(tvcard, cardDetail.TuningDetail,
userCopy);
if (ticket != null)
{
tickets.Add(ticket);
}
}
}
}
return tickets;
}
示例3: Add
/// <summary>
/// Adds the specified user.
/// </summary>
/// <param name = "user">The user.</param>
public void Add(IUser user)
{
Log.Info("user:{0} add", user.Name);
if (_owner == null)
{
_owner = user;
}
int i = _users.FindIndex(t => t.Name == user.Name);
if (i > -1)
{
_users[i] = (User)user.Clone();
}
else
{
_users.Add(user);
}
}
示例4: RequestCardReservation
public static ICardTuneReservationTicket RequestCardReservation(IUser user, CardDetail cardDetail, TVController tvController, ICardReservation cardResImpl, int idChannel)
{
ICardTuneReservationTicket ticket = null;
int idCard = cardDetail.Card.IdCard;
IUser userCopy = user.Clone() as User;
if (userCopy != null)
{
IDictionary<int, ITvCardHandler> cards = tvController.CardCollection;
userCopy.CardId = idCard;
ITvCardHandler tvcard = cards[idCard];
ticket = cardResImpl.RequestCardTuneReservation(tvcard, cardDetail.TuningDetail, userCopy, idChannel);
}
return ticket;
}