public void RemoveItem(IStyleGalleryItem istyleGalleryItem_0) { Guid guid; object obj; if (this.string_0 != "") { string str = this.method_2(istyleGalleryItem_0); if (str.Length != 0 && istyleGalleryItem_0.ID != -1) { IPersistStream item = (IPersistStream)istyleGalleryItem_0.Item; IMemoryBlobStream memoryBlobStreamClass = new MemoryBlobStream(); (new ObjectStream()).Stream = memoryBlobStreamClass; item.GetClassID(out guid); item.Save(memoryBlobStreamClass, 1); ((IMemoryBlobStreamVariant)memoryBlobStreamClass).ExportToVariant(out obj); Array arrays = (Array)obj; byte[] numArray = new byte[arrays.Length + 16]; guid.ToByteArray().CopyTo(numArray, 0); arrays.CopyTo(numArray, 16); obj = numArray; OleDbConnection oleDbConnection = new OleDbConnection(string.Concat("Provider=Microsoft.Jet.OLEDB.4.0;Data source= ", this.string_0)); oleDbConnection.Open(); OleDbCommand d = this.method_7(str, oleDbConnection); d.Parameters["ID"].Value = istyleGalleryItem_0.ID; d.ExecuteNonQuery(); oleDbConnection.Close(); } } }
private void FillComboWithEnumValues(ComboBox combo, Type enumType) { System.Array values = Enum.GetValues(enumType); object[] styles = new object[values.Length]; values.CopyTo(styles, 0); combo.Items.AddRange(styles); }
public static void AddItemToArray(object item, System.Array array) { int arraySize = array.GetLength(0); Array tempArray = Array.CreateInstance(item.GetType(), arraySize + 1); array.CopyTo(tempArray, 0); array = tempArray; array.SetValue(item, arraySize); }
/// <summary> /// Append item to the end of given array. /// Not effective - reallocation happends. /// </summary> /// <param name="arrExtended">Appended array</param> /// <param name="objAppended">Appended object</param> /// <param name="objTypeOf">Type of appended item</param> /// <returns>Newly allocated array with appended item</returns> private System.Array AppendItem(System.Array arrExtended, Object objAppended, System.Type objTypeOf) { int intNewLength = arrExtended.Length + 1; System.Array arrReturned = Array.CreateInstance(objTypeOf, intNewLength); arrExtended.CopyTo(arrReturned, 0); arrReturned.SetValue(objAppended, arrExtended.Length); return(arrReturned); }
private Guid ParseDeviceId() { Byte[] deviceGuid = new Byte[16]; String macWithoutColons = this.BluetoothDevice.Address.Replace(":", ""); Byte[] macBytes = Enumerable.Range(0, macWithoutColons.Length) .Where(x => x % 2 == 0) .Select(x => Convert.ToByte(macWithoutColons.Substring(x, 2), 16)) .ToArray(); macBytes.CopyTo(deviceGuid, 10); return(new Guid(deviceGuid)); }
private static Array CombineArrays(Array arr1, Array arr2) { if (arr1 == null) return arr2; if (arr2 == null) return arr1; Array newArr = Array.CreateInstance(arr1.GetType().GetElementType(), arr1.Length + arr2.Length); arr1.CopyTo(newArr, 0); arr2.CopyTo(newArr, arr1.Length); return newArr; }
private static TResult[] get_results_array <TResult>(System.Array results_sa, int numitems) { if (results_sa.Length != numitems) { string msg = String.Format("Expected {0} items from GetResults but only received {1}", numitems, results_sa.Length); throw new AutomationException(msg); } TResult[] results = new TResult[results_sa.Length]; results_sa.CopyTo(results, 0); return(results); }
//�ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ��������Ӻ��� public static Array Join(Array list1, Array list2, Type arrayType) { Array list = null; if (list1 != null && list2 != null) { list = Activator.CreateInstance(arrayType, list1.Length + list2.Length) as Array; if (list != null) { list1.CopyTo(list, 0); list2.CopyTo(list, list1.Length); } } return list; }
static int CopyTo(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); System.Array obj = (System.Array)ToLua.CheckObject(L, 1, typeof(System.Array)); System.Array arg0 = (System.Array)ToLua.CheckObject(L, 2, typeof(System.Array)); long arg1 = (long)LuaDLL.luaL_checknumber(L, 3); obj.CopyTo(arg0, arg1); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static public int CopyTo__Array__Int32(IntPtr l) { try { System.Array self = (System.Array)checkSelf(l); System.Array a1; checkType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); self.CopyTo(a1, a2); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
public UnitComponent PflongeOnUnit(System.Array newextensions) { if (ComponentExtendsTheOptionalstateOrder) { UNIT = this.gameObject.GetComponent <UnitScript>(); StateExtensions = new System.Enum[newextensions.Length]; newextensions.CopyTo(StateExtensions, 0); this.ID = UNIT.Options.RegisterUnitComponent(this, StateExtensions); SignIn(); return(this); } else { return(PflongeOnUnit()); } }
/// <summary> /// Adds new points to the SnapClass' point index. /// </summary> /// <param name="newShape">The shape containing data to add to the points index.</param> public void AddShapeData(int shpIndex, int snaplayeridx) { int numPoints = 0; double [] pts; System.Array arr = ((MapWinGIS.Shapefile)m_sfs[snaplayeridx]).QuickPoints(shpIndex, ref numPoints); pts = new double[arr.Length]; arr.CopyTo(pts, 0); arr = null; for (int j = 0; j < pts.Length; j += 2) { if (((System.Collections.SortedList)m_lists[snaplayeridx]).ContainsKey(pts[j])) { // the x value is already in the list. Add the y value to the "values" list. System.Collections.SortedList yLst; yLst = (System.Collections.SortedList)((System.Collections.SortedList)m_lists[snaplayeridx]).GetByIndex(((System.Collections.SortedList)m_lists[snaplayeridx]).IndexOfKey(pts[j])); if (yLst.ContainsKey(pts[j + 1]) == false) { // does not contain the y point yet SnapData data = new SnapData(shpIndex, (int)j / 2, new PointD(pts[j], pts[j + 1])); System.Collections.ArrayList l = new System.Collections.ArrayList(); l.Add(data); yLst.Add(pts[j + 1], l); } else { // already containt the y point (duplicate point) SnapData data = new SnapData(shpIndex, (int)j / 2, new PointD(pts[j], pts[j + 1])); ((System.Collections.ArrayList)yLst.GetByIndex(yLst.IndexOfKey(pts[j + 1]))).Add(data); } } else { System.Collections.SortedList y_list = new System.Collections.SortedList(); SnapData data = new SnapData(shpIndex, (int)j / 2, new PointD(pts[j], pts[j + 1])); System.Collections.ArrayList l = new System.Collections.ArrayList(); l.Add(data); y_list.Add(pts[j + 1], l); ((System.Collections.SortedList)m_lists[snaplayeridx]).Add(pts[j], y_list); } } pts = null; }
static StackObject *CopyTo_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Int32 @index = ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.Array @array = (System.Array) typeof(System.Array).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); System.Array instance_of_this_method = (System.Array) typeof(System.Array).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.CopyTo(@array, @index); return(__ret); }
public static Array Add(Array aFirst, Array aSecond) { if (aFirst == null) { return aSecond.Clone() as Array; } if (aSecond == null) { return aFirst.Clone() as Array; } Type typeFirst = aFirst.GetType().GetElementType(); Type typeSecond = aSecond.GetType().GetElementType(); System.Diagnostics.Debug.Assert(typeFirst == typeSecond); Array aNewArray = Array.CreateInstance(typeFirst, aFirst.Length + aSecond.Length); aFirst.CopyTo(aNewArray, 0); aSecond.CopyTo(aNewArray, aFirst.Length); return aNewArray; }
private void PrintRequestCompleted(int result, int responseCode, Array<string> headers, Array<byte> body) { GD.Print("result: ", result); GD.Print("response_code: ", responseCode); GD.Print("Headers count " + headers.Count); for (int j = 0; j < headers.Count; ++j) { GD.Print("header " + j + " " + headers[j]); } byte[] bytes = new byte[body.Count]; body.CopyTo(bytes, 0); string str = System.Text.Encoding.Default.GetString(bytes); GD.Print("str ", str); if (str.Empty()) { return; } JSONParseResult jsonParseResult = JSON.Parse(str); GD.Print("jsonParseResult is ", jsonParseResult); GD.Print("jsonParseResult.Result is ", jsonParseResult.Result); GD.Print("jsonParseResult.Result.GetType() " + jsonParseResult.Result.GetType()); Godot.Collections.Array arrResults = jsonParseResult.Result as Godot.Collections.Array; if (null == arrResults) { return; } GD.Print("arrResults count " + arrResults.Count); // for (int i = 0; i < arrResults.Count; ++i) // { // Godot.Collections.Dictionary dict = arrResults[i] as Godot.Collections.Dictionary; // GD.Print(dict["id"]); // GD.Print(dict["name"]); // GD.Print(dict["score"]); // } }
/// <summary> /// Fills dest with a rotated version of source. /// </summary> /// <param name="source">The source array.</param> /// <param name="dest">The dest array, which must have the same length and underlying type /// as source.</param> /// <param name="rotation">The number of elements to rotate to the left by.</param> private static void RotateArrayLeft(Array source, Array dest, int rotation) { if (source.Length != dest.Length) { throw new ArgumentException("source and dest lengths differ."); } if (rotation == 0) { source.CopyTo(dest, 0); } else { for (int i = 0; i < source.Length; ++i) { dest.SetValue(source.GetValue((rotation + i) % source.Length), i); } } }
public void CopyTo(Array array, int index) { array.CopyTo(array, index); }
public void AcquireWriteLock_ReadWrite_LocksCorrectly() { var name = Guid.NewGuid().ToString(); Random r = new Random(); int bufSize = 1024; byte[] data = new byte[bufSize]; byte[] readBuf = new byte[bufSize]; bool readIsFirst = false; bool readBlocked = false; int syncValue = 0; // Fill with random data r.NextBytes(data); using (var sma = new Array<byte>(name, bufSize)) { // Acquire write lock early sma.AcquireWriteLock(); using (var smr = new Array<byte>(name)) { var t1 = Task.Factory.StartNew(() => { if (System.Threading.Interlocked.Exchange(ref syncValue, 1) == 0) readIsFirst = true; // Should block until write lock is released smr.AcquireReadLock(); if (System.Threading.Interlocked.Exchange(ref syncValue, 3) == 4) readBlocked = true; smr.CopyTo(readBuf); smr.ReleaseReadLock(); }); System.Threading.Thread.Sleep(10); var t2 = Task.Factory.StartNew(() => { var val = System.Threading.Interlocked.Exchange(ref syncValue, 2); if (val == 0) readIsFirst = false; else if (val == 3) readBlocked = false; System.Threading.Thread.Sleep(10); sma.Write(data); System.Threading.Interlocked.Exchange(ref syncValue, 4); sma.ReleaseWriteLock(); }); Task.WaitAll(t1, t2); Assert.IsTrue(readIsFirst, "The read thread did not enter first."); Assert.IsTrue(readBlocked, "The read thread did not block."); // Check data was written before read for (var i = 0; i < readBuf.Length; i++) { Assert.AreEqual(data[i], readBuf[i]); } } } }
public static object[] AppendToArray(Array currentListeners, object listener) { var elemType = currentListeners.GetType().GetElementType(); var newListeners = Array.CreateInstance(elemType, currentListeners.Length + 1); currentListeners.CopyTo(newListeners, 0); newListeners.SetValue(listener, currentListeners.Length); return (object[]) newListeners; }
public void setRow(int row, Array vals) { vals.CopyTo (boxes, row * 4); }
public void CopyTo_NullArray_ThrowsException() { var name = Guid.NewGuid().ToString(); using (var sma = new Array<int>(name, 10)) { bool exceptionThrown = false; try { sma.CopyTo(null); } catch (ArgumentNullException) { exceptionThrown = true; } Assert.IsTrue(exceptionThrown, "null buffer should result in ArgumentNullException"); } }
/// <summary> /// Creates an <see cref="InPredicate"/>. /// </summary> /// <param name="field">Database field.</param> /// <param name="values">List of values.</param> /// <param name="negate">Specifies whether the predicate is negated (NOT IN).</param> /// <returns>InPredicate.</returns> /// <remarks>Creates an IN predicate that determines if a field matches any value in a list.</remarks> public static InPredicate In(IDbColumn field, Array values, bool negate) { object[] objValues = new object[values.Length]; values.CopyTo(objValues, 0); return In(field, objValues, negate); }
void DrawControlSchemeGUI() { ControlScheme scheme = m_ActionMapEditCopy.controlSchemes[selectedScheme]; EditorGUI.BeginChangeCheck(); string schemeName = EditorGUILayout.TextField("Control Scheme Name", scheme.name); if (EditorGUI.EndChangeCheck()) { scheme.name = schemeName; } for (int i = 0; i < scheme.deviceSlots.Count; i++) { var deviceSlot = scheme.deviceSlots[i]; Rect rect = EditorGUILayout.GetControlRect(); if (Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition)) { m_SelectedDeviceIndex = i; Repaint(); } if (m_SelectedDeviceIndex == i) { GUI.DrawTexture(rect, EditorGUIUtility.whiteTexture); } string[] tagNames = null; Vector2 tagMaxSize = Vector2.zero; if (deviceSlot.type != null && deviceSlot.type.value != null) { tagNames = InputDeviceUtility.GetDeviceTags(deviceSlot.type.value); if (tagNames != null) { GUIContent content = new GUIContent(); for (var j = 0; j < tagNames.Length; j++) { content.text = tagNames[j]; Vector2 size = EditorStyles.popup.CalcSize(content); tagMaxSize = Vector2.Max(size, tagMaxSize); } } } rect.width -= tagMaxSize.x; // Adjust width to leave room for tag EditorGUI.BeginChangeCheck(); Type t = TypeGUI.TypeField(rect, new GUIContent("Device Type"), typeof(InputDevice), deviceSlot.type); if (EditorGUI.EndChangeCheck()) { deviceSlot.type = t; } if (tagNames != null) { EditorGUI.BeginChangeCheck(); // We want to have the ability to unset a tag after specifying one, so add an "Any" option var popupTags = new string[tagNames.Length + 1]; popupTags[0] = "Any"; tagNames.CopyTo(popupTags, 1); int tagIndex = deviceSlot.tagIndex + 1; rect.x += rect.width; rect.width = tagMaxSize.x; tagIndex = EditorGUI.Popup( rect, tagIndex, popupTags); if (EditorGUI.EndChangeCheck()) { deviceSlot.tagIndex = tagIndex - 1; } } } // Device remove and add buttons EditorGUILayout.BeginHorizontal(); { GUILayout.Space(15 * EditorGUI.indentLevel); if (GUILayout.Button(Styles.iconToolbarMinus, GUIStyle.none)) { RemoveDevice(); } if (GUILayout.Button(Styles.iconToolbarPlus, GUIStyle.none)) { AddDevice(); } GUILayout.FlexibleSpace(); } EditorGUILayout.EndHorizontal(); // Pad this area with spacing so all control schemes use same heights, // and the actions table below doesn't move when switching control scheme. int maxDevices = 0; for (int i = 0; i < m_ActionMapEditCopy.controlSchemes.Count; i++) { maxDevices = Mathf.Max(maxDevices, m_ActionMapEditCopy.controlSchemes[i].deviceSlots.Count); } int extraLines = maxDevices - scheme.deviceSlots.Count; EditorGUILayout.GetControlRect(true, extraLines * (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing)); }
public void TestWriteToAndReadFrom() { using (var map = new MemoryMapStream()) { using (var memoryStream = new MemoryStream()) { using (var array = new Array<int>(map, 10)) { for (var i = 0; i < array.Length; i++) { array[i] = i + 100; } array.CopyTo(memoryStream); memoryStream.Seek(0, SeekOrigin.Begin); using (var array1 = new Array<int>(map, array.Length)) { array1.CopyFrom(memoryStream); for (var i = 0; i < array.Length; i++) { Assert.AreEqual(array[i], array1[i]); } } } } } using (var map = new MemoryMapStream()) { using (var memoryStream = new MemoryStream()) { using (var array = new Array<int>(map, 10000, 32, 32, 2)) { for (var i = 0; i < array.Length; i++) { array[i] = i + 100; } array.CopyFrom(memoryStream); memoryStream.Seek(0, SeekOrigin.Begin); using (var array1 = new Array<int>(map, array.Length)) { array.CopyFrom(memoryStream); for (var i = 0; i < array.Length; i++) { Assert.AreEqual(array[i], array1[i]); } } } } } }
void FixedUpdate() { if (Input.GetKeyDown(KeyCode.Space)) { userPaused = !userPaused; } if (userPaused) { return; } //CalcBorderStuff(); civilizaitons.CopyTo(civsCopy, 0); foreach (Civilization civ in civsCopy) { if (civ == null) { continue; // skip empty civs; } Profiler.BeginSample("City Expansion"); foreach (City city in civ.Cities) { if (Random.value > 0.2f) { continue; } HexRef xref; int maxDistance = Mathf.CeilToInt(Mathf.Pow(Random.value, 3) * 2.99f); maxDistance = Mathf.Max(maxDistance, 1); bool foundTile = TryGetNewCityTileLocation(city, out xref, maxDistance); if (foundTile) { float tileValue = CalcCityTileValue(xref, city); if (tileValue > tileValueTreshold) { SetOwnership(xref.Index, civ.civID); } } } // end for each city Profiler.EndSample(); //Conquest if (Random.value < 0.005f) { Profiler.BeginSample("Conquest"); int roffset = Random.Range(0, civ.Cities.Count); for (int i = 0; i < civ.Cities.Count; i++) { City sourceCity = civ.Cities[(i + roffset) % civ.Cities.Count]; int dist; City targetCity = GetNearestCityWithCondition(sourceCity.Hex, out dist, o => o.ownerID != civ.civID); if (dist <= 6) { Civilization targetCiv = GetCiv(targetCity.ownerID); Debug.LogFormat(" {0} captured {1} from {2}", civ.name, targetCity.name, GetCiv(targetCity.ownerID)); if (targetCiv == null) { Debug.Log("OwnerID: " + targetCity.ownerID); Debug.LogFormat(" {0} captured {1} from {2}", civ.civIndex, targetCity.name, GetCiv(targetCity.ownerID).civIndex); Debug.LogError("Target City's Civ is Null"); break; } CaptureCity(targetCity, civ); break; } } Profiler.EndSample(); } // ChanceForRebellion else if (CanSpawnNewCivs() && civ.Cities.Count >= 6 && Random.value < 0.004f) { Profiler.BeginSample("Rebellion"); City rebelCity = civ.Cities[Random.Range(1, civ.Cities.Count - 1)]; Debug.LogFormat("Rebellion at {0}!", rebelCity.name); Civilization newCiv = StartNewCiv(rebelCity); TransferCityTerritory(rebelCity, newCiv, civ); Profiler.EndSample(); } else if (civ.Cities.Count < maxCitiesPerCiv && Random.value < 0.005f) // spawn new city { Profiler.BeginSample("Spawning Civs"); HexRef xref; bool foundCityLocation = TryGetNewCityLocation(civ, out xref); if (foundCityLocation) // if true cell is valid { float cityValue = CalcCityValue(xref); if (cityValue > cityValueTreshold) { City newCity = spawnCity(xref); civ.AddCity(newCity); } } Profiler.EndSample(); } } // Spawn New Civ if (CanSpawnNewCivs() && Random.value < 0.0003f) { SpawnCivs(1, 20); } // remove dead civilizations RemoveDeadCivs(); // if(Input.GetMouseButtonUp(0)) // { // Hex mouseHex = gameGrid.MouseHex(); // Hex[] circle = Hex.HexCircle(mouseHex,3); // circle = gameGrid.ValidHexes(circle); // foreach(Hex h in circle) // { // int index = gameGrid.HexToIndex(h); // SetOwnership(index, 5); // } // } } // end fixed Update
internal static object[] GetCustomAttributes(ICustomAttributeProvider obj, Type attributeType, bool inherit) { if (obj == null) { throw new ArgumentNullException("obj"); } if (attributeType == null) { throw new ArgumentNullException("attributeType"); } if (attributeType == typeof(MonoCustomAttrs)) { attributeType = null; } object[] r; object[] res = GetCustomAttributesBase(obj, attributeType, false); // shortcut if (!inherit && res.Length == 1) { if (res [0] == null) { throw new CustomAttributeFormatException("Invalid custom attribute format"); } if (attributeType != null) { if (attributeType.IsAssignableFrom(res[0].GetType())) { r = (object[])Array.CreateInstance(attributeType, 1); r[0] = res[0]; } else { r = (object[])Array.CreateInstance(attributeType, 0); } } else { r = (object[])Array.CreateInstance(res[0].GetType(), 1); r[0] = res[0]; } return(r); } if (inherit && GetBase(obj) == null) { inherit = false; } // if AttributeType is sealed, and Inherited is set to false, then // there's no use in scanning base types if ((attributeType != null && attributeType.IsSealed) && inherit) { AttributeUsageAttribute usageAttribute = RetrieveAttributeUsage( attributeType); if (!usageAttribute.Inherited) { inherit = false; } } var initialSize = Math.Max(res.Length, 16); List <Object> a = null; ICustomAttributeProvider btype = obj; object[] array; /* Non-inherit case */ if (!inherit) { if (attributeType == null) { foreach (object attr in res) { if (attr == null) { throw new CustomAttributeFormatException("Invalid custom attribute format"); } } var result = new Attribute [res.Length]; res.CopyTo(result, 0); return(result); } a = new List <object> (initialSize); foreach (object attr in res) { if (attr == null) { throw new CustomAttributeFormatException("Invalid custom attribute format"); } Type attrType = attr.GetType(); if (attributeType != null && !attributeType.IsAssignableFrom(attrType)) { continue; } a.Add(attr); } if (attributeType == null || attributeType.IsValueType) { array = new Attribute [a.Count]; } else { array = Array.CreateInstance(attributeType, a.Count) as object[]; } a.CopyTo(array, 0); return(array); } /* Inherit case */ var attributeInfos = new Dictionary <Type, AttributeInfo> (initialSize); int inheritanceLevel = 0; a = new List <object> (initialSize); do { foreach (object attr in res) { AttributeUsageAttribute usage; if (attr == null) { throw new CustomAttributeFormatException("Invalid custom attribute format"); } Type attrType = attr.GetType(); if (attributeType != null) { if (!attributeType.IsAssignableFrom(attrType)) { continue; } } AttributeInfo firstAttribute; if (attributeInfos.TryGetValue(attrType, out firstAttribute)) { usage = firstAttribute.Usage; } else { usage = RetrieveAttributeUsage(attrType); } // only add attribute to the list of attributes if // - we are on the first inheritance level, or the attribute can be inherited anyway // and ( // - multiple attributes of the type are allowed // or ( // - this is the first attribute we've discovered // or // - the attribute is on same inheritance level than the first // attribute that was discovered for this attribute type )) if ((inheritanceLevel == 0 || usage.Inherited) && (usage.AllowMultiple || (firstAttribute == null || (firstAttribute != null && firstAttribute.InheritanceLevel == inheritanceLevel)))) { a.Add(attr); } if (firstAttribute == null) { attributeInfos.Add(attrType, new AttributeInfo(usage, inheritanceLevel)); } } if ((btype = GetBase(btype)) != null) { inheritanceLevel++; res = GetCustomAttributesBase(btype, attributeType, true); } } while (inherit && btype != null); if (attributeType == null || attributeType.IsValueType) { array = new Attribute [a.Count]; } else { array = Array.CreateInstance(attributeType, a.Count) as object[]; } // copy attributes to array a.CopyTo(array, 0); return(array); }
void ICollection.CopyTo (Array array, int index) { // assuming that Nodes is a correct collection. array.CopyTo (Nodes.ToArray (typeof(XmlAttribute)), index); }
public static void CopyTo <T>(this T[] array, Memory <T> destination) { array.CopyTo(destination.Span); }