本文整理汇总了C#中System.Collections.Generic.List.AddRange方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.Generic.List.AddRange方法的具体用法?C# System.Collections.Generic.List.AddRange怎么用?C# System.Collections.Generic.List.AddRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Generic.List
的用法示例。
在下文中一共展示了System.Collections.Generic.List.AddRange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: __encode
public System.Collections.Generic.List<byte> __encode()
{
var data = new System.Collections.Generic.List<byte>();
data.AddRange(Proto4z.BaseProtoObject.encodeUI64(uID));
data.AddRange(Proto4z.BaseProtoObject.encodeString(token));
data.AddRange(Proto4z.BaseProtoObject.encodeUI32(expire));
return data;
}
示例2: __encode
public System.Collections.Generic.List<byte> __encode()
{
var ret = new System.Collections.Generic.List<byte>();
ret.AddRange(BaseProtoObject.encodeUI32(packLen));
ret.AddRange(BaseProtoObject.encodeUI16(reserve));
ret.AddRange(BaseProtoObject.encodeUI16(protoID));
return ret;
}
示例3: ToBytes
public byte[] ToBytes()
{
System.Collections.Generic.List<byte> dataBuffer = new System.Collections.Generic.List<byte>();
dataBuffer.AddRange(TypeMarshal.ToBytes<ushort>((ushort)(this.BlockT.blockType)));
dataBuffer.AddRange(TypeMarshal.ToBytes<uint>(this.BlockT.blockLen));
dataBuffer.AddRange(TypeMarshal.ToBytes<byte>(this.numChannels));
dataBuffer.AddRange(TypeMarshal.ToBytes<TS_RFX_CHANNELT>(this.channels[0]));
return dataBuffer.ToArray();
}
示例4: __encode
public System.Collections.Generic.List<byte> __encode()
{
var data = new System.Collections.Generic.List<byte>();
data.AddRange(Proto4z.BaseProtoObject.encodeUI64(this.id));
data.AddRange(Proto4z.BaseProtoObject.encodeUI64(this.serviceID));
data.AddRange(Proto4z.BaseProtoObject.encodeString(this.streamBlob));
data.AddRange(Proto4z.BaseProtoObject.encodeUI16(this.status));
data.AddRange(Proto4z.BaseProtoObject.encodeUI64(this.timestamp));
return data;
}
示例5: Create
/// <summary>
///
/// </summary>
/// <param name="lt"></param>
/// <param name="rt"></param>
/// <param name="lb"></param>
/// <param name="rb"></param>
/// <returns></returns>
public static AttributeBase Create( float[] lt, float[] rt, float[] lb, float[] rb )
{
System.Collections.Generic.List<float> values = new System.Collections.Generic.List<float>( 2 * 4 );
values.AddRange( lt );
values.AddRange( rt );
values.AddRange( lb );
values.AddRange( rb );
var self = new AttributeBase( AttributeBase.Target.kVertex, null,
values.ToArray(), null );
return self;
}
示例6: __encode
public System.Collections.Generic.List<byte> __encode()
{
Proto4z.ui32 sttLen = 0;
Proto4z.ui64 tag = 3;
var data = new System.Collections.Generic.List<byte>();
data.AddRange(retCode.__encode());
data.AddRange(users.__encode());
sttLen = (System.UInt32)data.Count + 8;
var ret = new System.Collections.Generic.List<byte>();
ret.AddRange(sttLen.__encode());
ret.AddRange(tag.__encode());
ret.AddRange(data);
return ret;
}
示例7: BuildElementList
protected override IList<Microsoft.VisualStudio.Modeling.ModelElement> BuildElementList(object component)
{
Microsoft.VisualStudio.Modeling.DomainClassInfo domainClassInfo = DomainRoleInfo.RolePlayer;
if (domainClassInfo == null || component == null)
return new System.Collections.Generic.List<Microsoft.VisualStudio.Modeling.ModelElement>();
Microsoft.VisualStudio.Modeling.Store store = this.GetStore(component);
DomainRole domainRole = component as DomainRole;
System.Collections.Generic.List<Microsoft.VisualStudio.Modeling.ModelElement> list = new System.Collections.Generic.List<Microsoft.VisualStudio.Modeling.ModelElement>();
list.AddRange(domainRole.Relationship.GetMetaModel().PropertyGridEditors);
System.Collections.Generic.IList<Microsoft.VisualStudio.Modeling.ModelElement> ilist = store.ElementDirectory.FindElements(domainClassInfo, false);
foreach (Microsoft.VisualStudio.Modeling.ModelElement modelElement in ilist)
{
PropertyGridEditor p = modelElement as PropertyGridEditor;
bool bFound = false;
foreach (PropertyGridEditor e in list)
if (e.Name == p.Name)
{
bFound = true;
break;
}
if (!bFound)
list.Add(p);
}
return list;
}
示例8: FromProperty
public static Specification FromProperty(PropertyInfo property)
{
System.Collections.Generic.List<string> enumList = new System.Collections.Generic.List<string>();
if (property.PropertyType.IsEnum)
{
enumList.AddRange(Enum.GetNames(property.PropertyType));
}
var attrs = property.GetCustomAttributes(true);
var oa = attrs.OfType<OptionAttribute>();
if (oa.Count() == 1)
{
var spec = OptionSpecification.FromAttribute(oa.Single(), property.PropertyType, enumList);
if (spec.ShortName.Length == 0 && spec.LongName.Length == 0)
{
return spec.WithLongName(property.Name.ToLowerInvariant(), enumList);
}
return spec;
}
var va = attrs.OfType<ValueAttribute>();
if (va.Count() == 1)
{
return ValueSpecification.FromAttribute(va.Single(), property.PropertyType);
}
throw new InvalidOperationException();
}
示例9: Start
void Start()
{
Foxes = new System.Collections.Generic.List<GameObject>();
Foxes.AddRange(new[] { DownLeftFox, DownRightFox, UpLeftFox, UpRightFox });
SetUnvisibleAll();
DownRightFox.SetActive(true);
}
示例10: ProcessRequest
//TODO simple JSON writer
//struct Info
//{
// public string Provider { get; set; }
//}
public override void ProcessRequest(WebRequest request)
{
//We don't need a list here, but I rather get away from the lock quicker.
var dependencies = new System.Collections.Generic.List<ResourceDependancy>();
WebServer.ForEachPage((page) =>
{
var dpd = page.GetDependencies();
if (dpd != null)
{
dependencies.AddRange(dpd);
}
});
//Since we are using a list we can make it a bit easier
request.Writer.Buffer(dependencies.Count);
foreach (var item in dependencies)
{
request.Writer.Buffer((byte)item.Type);
request.Writer.Buffer(item.Url);
}
dependencies.Clear();
dependencies = null;
request.WriteOut("application/octet-stream");
}
示例11: BasicTest
public void BasicTest()
{
System.Collections.Generic.List<string> TestObject = new System.Collections.Generic.List<string>();
TestObject.AddRange(new string[] { "this", "is", "a", "test" });
ListMapping<int, string> Results = TestObject.Permute();
Assert.Equal(24, Results.Keys.Count);
foreach (int Key in Results.Keys)
foreach (string Item in Results[Key])
Assert.True(Item == "this" || Item == "is" || Item == "a" || Item == "test");
}
示例12: ToBytes
public byte[] ToBytes()
{
System.Collections.Generic.List<byte> dataBuffer = new System.Collections.Generic.List<byte>();
dataBuffer.AddRange(TypeMarshal.ToBytes<ushort>((ushort)this.CodecChannelT.blockType));
dataBuffer.AddRange(TypeMarshal.ToBytes<uint>(this.CodecChannelT.blockLen));
dataBuffer.AddRange(TypeMarshal.ToBytes<byte>(this.CodecChannelT.codecId));
dataBuffer.AddRange(TypeMarshal.ToBytes<byte>(this.CodecChannelT.channelId));
dataBuffer.AddRange(TypeMarshal.ToBytes<byte>(this.regionFlags));
dataBuffer.AddRange(TypeMarshal.ToBytes<ushort>(this.numRects));
foreach (TS_RFX_RECT rect in this.rects)
{
dataBuffer.AddRange(TypeMarshal.ToBytes<TS_RFX_RECT>(rect));
}
dataBuffer.AddRange(TypeMarshal.ToBytes<ushort>(this.regionType));
dataBuffer.AddRange(TypeMarshal.ToBytes<ushort>(this.numTilesets));
return dataBuffer.ToArray();
}
示例13: ShouldCallOnMessageAfterSplitFrame
public void ShouldCallOnMessageAfterSplitFrame()
{
const string part1 = "Writing tests";
const string part2 = " is good for your health";
const string expected = part1 + part2;
var bytes = new System.Collections.Generic.List<byte>();
bytes.Add(0);
bytes.AddRange(Encoding.UTF8.GetBytes(part1));
var bytes2 = new System.Collections.Generic.List<byte>();
bytes.AddRange(Encoding.UTF8.GetBytes(part2));
bytes.Add(255);
string result = null;
_onMessage = s => result = s;
_handler.Recieve(bytes);
_handler.Recieve(bytes2);
Assert.AreEqual(expected, result);
}
示例14: Create
/// <summary>
///
/// </summary>
/// <param name="isVisible"></param>
public static AttributeBase Create( int? integer, float[] point, float[] rect, string message )
{
bool[] has = { integer.HasValue, point != null, rect != null, message != null };
int[] iValues = new int[1];
if ( integer.HasValue ) {
iValues[0] = integer.Value;
}
var floats = new System.Collections.Generic.List<float>( 6 );
if ( point != null ) {
floats.AddRange( point );
}
if ( rect != null ) {
floats.AddRange( rect );
}
string[] texts = null;
if ( message != null ) {
texts = new string[] { message };
}
var self = new AttributeBase( AttributeBase.Target.kUserNotify, iValues, floats.ToArray(), has, texts );
return self;
}
示例15: ShouldCallOnMessageOnCompleteFrame
public void ShouldCallOnMessageOnCompleteFrame()
{
const string expected = "Once upon a time...";
var bytes = new System.Collections.Generic.List<byte>();
bytes.Add(0);
bytes.AddRange(Encoding.UTF8.GetBytes(expected));
bytes.Add(255);
string result = null;
_onMessage = s => result = s;
_handler.Recieve(bytes);
Assert.AreEqual(expected, result);
}