本文整理汇总了C#中Common.List.RemoveRange方法的典型用法代码示例。如果您正苦于以下问题:C# List.RemoveRange方法的具体用法?C# List.RemoveRange怎么用?C# List.RemoveRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Common.List
的用法示例。
在下文中一共展示了List.RemoveRange方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendVendorPage
public static void SendVendorPage(Player Plr, ref List<Creature_vendor> Vendors, byte Count,byte Page)
{
Count = (byte)Math.Min(Count, Vendors.Count);
Log.Success("SendVendorPage", "Count=" + Count + ",Page=" + Page + ",ItmC=" + Vendors.Count);
PacketOut Out = new PacketOut((byte)Opcodes.F_INIT_STORE);
Out.WriteByte(3);
Out.WriteByte(0);
Out.WriteByte(Page);
Out.WriteByte(Count);
Out.WriteByte((byte)(Page > 0 ? 0 : 1));
Out.WriteByte(1);
Out.WriteUInt16(0);
for (byte i = 0; i < Count; ++i)
{
Out.WriteByte(i);
Out.WriteByte(3); // sometimes 1
Out.WriteUInt32(Vendors[i].Price);
Item.BuildItem(ref Out, null, Vendors[i].Info, 0, 1);
Out.WriteByte((byte)Vendors[i].ItemsReqInfo.Count); // ReqItemSize
foreach (KeyValuePair<UInt16, Item_Info> Kp in Vendors[i].ItemsReqInfo)
{
Out.WriteUInt32(Kp.Value.Entry);
Out.WriteUInt16((UInt16)Kp.Value.ModelId);
Out.WritePascalString(Kp.Value.Name);
Out.WriteUInt16(Kp.Key);
Out.Fill(0, 18);
}
}
Out.WriteByte(0);
Plr.SendPacket(Out);
Vendors.RemoveRange(0, Count);
}
示例2: Execute
private void Execute()
{
List<byte> rxBuff = new List<byte>();
while(true)
{
byte[] read = new byte[1];
try
{
// Read
int rxed = _socket.Receive(read, read.Length, SocketFlags.None);
// Add data to buffer
rxBuff.AddRange(read.Take(rxed));
// process data if it contains a terminating character
if (rxBuff.Contains(0x02))
{
// retreive the string
string rxStr = Encoding.UTF8.GetString(rxBuff.Take(rxBuff.IndexOf(0x02)).ToArray());
// remove the data that was just converted into a string (plus the 0x02 terminator)
rxBuff.RemoveRange(0, rxBuff.IndexOf(0x02) + 1);
// Deserialize to the message structure
Message msg = JsonConvert.DeserializeObject<Message>(rxStr);
// Notify all listeners
if (msg != null)
{
OnMessageRxed(msg);
}
}
}
catch
{
OnDisconnected();
}
}
}