本文整理汇总了C#中System.Collections.ArrayList.ToArray方法的典型用法代码示例。如果您正苦于以下问题:C# ArrayList.ToArray方法的具体用法?C# ArrayList.ToArray怎么用?C# ArrayList.ToArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.ArrayList
的用法示例。
在下文中一共展示了ArrayList.ToArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NDataReader
/// <summary>
/// Creates a NDataReader from a <see cref="IDataReader" />
/// </summary>
/// <param name="reader">The <see cref="IDataReader" /> to get the records from the Database.</param>
/// <param name="isMidstream"><see langword="true" /> if we are loading the <see cref="IDataReader" /> in the middle of reading it.</param>
/// <remarks>
/// NHibernate attempts to not have to read the contents of an <see cref="IDataReader"/> into memory until it absolutely
/// has to. What that means is that it might have processed some records from the <see cref="IDataReader"/> and will
/// pick up the <see cref="IDataReader"/> midstream so that the underlying <see cref="IDataReader"/> can be closed
/// so a new one can be opened.
/// </remarks>
public NDataReader(IDataReader reader, bool isMidstream)
{
ArrayList resultList = new ArrayList(2);
try
{
// if we are in midstream of processing a DataReader then we are already
// positioned on the first row (index=0)
if (isMidstream)
{
currentRowIndex = 0;
}
// there will be atleast one result
resultList.Add(new NResult(reader, isMidstream));
while (reader.NextResult())
{
// the second, third, nth result is not processed midstream
resultList.Add(new NResult(reader, false));
}
results = (NResult[]) resultList.ToArray(typeof(NResult));
}
catch (Exception e)
{
throw new ADOException("There was a problem converting an IDataReader to NDataReader", e);
}
finally
{
reader.Close();
}
}
示例2: GetClassDefinition
public override ClassDefinition GetClassDefinition(object instance)
{
Type type = instance.GetType();
BindingFlags bindingAttr = BindingFlags.Public | BindingFlags.Instance;
PropertyInfo[] propertyInfos = type.GetProperties(bindingAttr);
#if !(NET_1_1)
List<ClassMember> classMemberList = new List<ClassMember>();
#else
ArrayList classMemberList = new ArrayList();
#endif
for (int i = 0; i < propertyInfos.Length; i++)
{
PropertyInfo propertyInfo = propertyInfos[i];
if (propertyInfo.Name != "HelpLink" && propertyInfo.Name != "TargetSite")
{
ClassMember classMember = new ClassMember(propertyInfo.Name, bindingAttr, propertyInfo.MemberType, null);
classMemberList.Add(classMember);
}
}
string customClassName = type.FullName;
customClassName = FluorineConfiguration.Instance.GetCustomClass(customClassName);
#if !(NET_1_1)
ClassMember[] classMembers = classMemberList.ToArray();
#else
ClassMember[] classMembers = classMemberList.ToArray(typeof(ClassMember)) as ClassMember[];
#endif
ClassDefinition classDefinition = new ClassDefinition(customClassName, classMembers, GetIsExternalizable(instance), GetIsDynamic(instance));
return classDefinition;
}
示例3: ListChildrenOf
public Item[] ListChildrenOf(string url)
{
Logger.LogMethod();
try
{
using (new UserImpersonator())
{
ArrayList list = new ArrayList();
object o = SharePointHelper.GetSharePointObject(url);
if (o is SPWeb)
{
using (SPWeb web = o as SPWeb)
{
PopulateListOfSubWebs(web, ref list);
PopulateListOfDocumentLibraries(web, ref list);
return (Item[]) list.ToArray(typeof(Item));
}
}
else if (o is SPFolder)
{
SPFolder folder = o as SPFolder;
PopulateListOfSubfolders( folder, ref list );
PopulateListOfFiles( folder, ref list );
return (Item[]) list.ToArray(typeof(Item));
}
return new Item[0];
}
}
catch (Exception ex)
{
Logger.LogException(ex.Message, ex);
throw;
}
}
示例4: ImportComComponent
internal bool ImportComComponent(string path, OutputMessageCollection outputMessages, string outputDisplayName)
{
ComImporter importer = new ComImporter(path, outputMessages, outputDisplayName);
if (importer.Success)
{
ArrayList list = new ArrayList();
if (this.typeLibs != null)
{
list.AddRange(this.typeLibs);
}
if (importer.TypeLib != null)
{
list.Add(importer.TypeLib);
}
this.typeLibs = (TypeLib[]) list.ToArray(typeof(TypeLib));
list.Clear();
if (this.comClasses != null)
{
list.AddRange(this.comClasses);
}
if (importer.ComClasses != null)
{
list.AddRange(importer.ComClasses);
}
this.comClasses = (ComClass[]) list.ToArray(typeof(ComClass));
}
return importer.Success;
}
示例5: reloadBase
private void reloadBase() {
this.removeAll ();
SideMenu = new ArrayList ();
Window = new ViewWindow ("");
Window.setWidth (800);
Window.setHeight (Screen.height - 200);
Window.setLeft ((Screen.width-800)/2);
Window.setTop (100);
this.addComponent (Window);
SideMenu.Add(new ViewButton("Current State", LoadCurrentState));
SideMenu.Add(new ViewButton("Space Stations", LoadSpaceStations));
SideMenu.Add(new ViewButton("Bases", LoadBases));
SideMenu.Add(new ViewButton("Sat Coverage", LoadSatelliteCoverage));
SideMenu.Add(new ViewButton("Science Stations", LoadScienceStations));
SideMenu.Add(new ViewButton("Mining Rigs", LoadMiningRigs));
SideMenu.Add(new ViewButton("Rovers", LoadRovers));
SideMenu.Add(new ViewButton("Kerbals", LoadKerbals));
SideMenu.Add(new ViewButton("Past Reviews", LoadPastReviews));
for (var i = 0; i < SideMenu.ToArray ().Length; i++) {
ViewButton Btn = (ViewButton)SideMenu.ToArray () [i];
Btn.setRelativeTo (Window);
Btn.setLeft (10);
Btn.setTop (10 + i * 45);
Btn.setWidth (120);
Btn.setHeight (35);
this.addComponent (Btn);
}
}
示例6: ReadTextStream
// Methods
public void ReadTextStream(TextReader tr, StringBuilder errs)
{
GcodeOpCode code = null;
ArrayList list = new ArrayList();
ArrayList list2 = new ArrayList();
long linenum = 1L;
while (true)
{
GcodeToken token;
do
{
token = GcodeToken.ReadToken(tr, errs, linenum);
if (token.ID == 0xffff)
{
if (code != null)
{
code.Parameter = (GcodeParameter[])list2.ToArray(typeof(GcodeParameter));
list.Add(code);
}
goto Label_0150;
}
}
while (token.ID == 'N');
if (token.ID == '\n')
{
linenum += 1L;
if (code != null)
{
code.Parameter = (GcodeParameter[])list2.ToArray(typeof(GcodeParameter));
list.Add(code);
code = null;
}
}
else if ((token.ID == 'G') || (token.ID == 'M'))
{
if (code != null)
{
code.Parameter = (GcodeParameter[])list2.ToArray(typeof(GcodeParameter));
list.Add(code);
}
code = new GcodeOpCode(string.Format("{0}{1:02}", token.ID, token.Value.ToString("00")));
list2.Clear();
}
else
{
if (code == null)
{
code = new GcodeOpCode(GcodeOpCode.OpCodes.Unknown);
}
GcodeParameter parameter = new GcodeParameter(token);
if (parameter.OpCode != GcodeOpCode.OpCodes.Unknown)
{
list2.Add(parameter);
}
}
}
Label_0150:
this.GCodes = (GcodeOpCode[])list.ToArray(typeof(GcodeOpCode));
}
示例7: GetParserStrings
/// <summary>
/// Sections:
/// GUIVideoArtistInfo, FanArt, IMDBposter, IMDBActors,
/// IMPAwardsposter, TMDBPosters, TMDBActorImages
/// IMDBActorInfoMain, IMDBActorInfoDetails, IMDBActorInfoMovies
/// </summary>
/// <param name="section"></param>
/// <returns></returns>
public static string[] GetParserStrings(string section)
{
ArrayList result = new ArrayList();
try
{
string parserIndexFile = Config.GetFile(Config.Dir.Config, "scripts\\VDBParserStrings.xml");
string parserIndexUrl = @"http://install.team-mediaportal.com/MP1/VDBParserStrings.xml";
XmlDocument doc = new XmlDocument();
if (!File.Exists(parserIndexFile))
{
if (DownloadFile(parserIndexFile, parserIndexUrl) == false)
{
string parserIndexFileBase = Config.GetFile(Config.Dir.Base, "VDBParserStrings.xml");
if (File.Exists(parserIndexFileBase))
{
File.Copy(parserIndexFileBase, parserIndexFile, true);
}
else
{
return result.ToArray(typeof(string)) as string[];
}
}
}
doc.Load(parserIndexFile);
if (doc.DocumentElement != null)
{
string sec = "/section/" + section;
XmlNode dbSections = doc.DocumentElement.SelectSingleNode(sec);
if (dbSections == null)
{
return result.ToArray(typeof(string)) as string[];
}
XmlNodeList parserStrings = dbSections.SelectNodes("string");
if (parserStrings != null)
{
foreach (XmlNode parserString in parserStrings)
{
result.Add(parserString.InnerText);
}
}
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return result.ToArray(typeof(string)) as string[];
}
示例8: Page_Load
protected void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack) {
IList galleries = CmsImageGallery.FindAllRoot();
ArrayList paths = new ArrayList();
foreach (CmsImageGallery g in galleries) {
paths.Add(g.FullPath);
}
TextBoxText.ImagesPaths = (string[])paths.ToArray(typeof(string));
TextBoxText.UploadImagesPaths = (string[])paths.ToArray(typeof(string));
}
}
示例9: HandlePacket
//rewritten by Corillian so if it doesn't work you know who to yell at ;)
public void HandlePacket(GameClient client, GSPacketIn packet)
{
byte grouped = (byte)packet.ReadByte();
ArrayList list = new ArrayList();
if (grouped != 0x00)
{
ArrayList groups = GroupMgr.ListGroupByStatus(0x00);
if (groups != null)
{
foreach (Group group in groups)
if (GameServer.ServerRules.IsAllowedToGroup(group.Leader, client.Player, true))
{
list.Add(group.Leader);
}
}
}
ArrayList Lfg = GroupMgr.LookingForGroupPlayers();
if (Lfg != null)
{
foreach (GamePlayer player in Lfg)
{
if (player != client.Player && GameServer.ServerRules.IsAllowedToGroup(client.Player, player, true))
{
list.Add(player);
}
}
}
client.Out.SendFindGroupWindowUpdate((GamePlayer[])list.ToArray(typeof(GamePlayer)));
}
示例10: GetMethodProperties
public static PropertyDescriptorCollection GetMethodProperties( object obj )
{
System.Type type = obj.GetType();
if ( obj is MethodPropertyDescriptor.MethodPropertyValueHolder )
{
MethodPropertyDescriptor.MethodPropertyValueHolder mobj = obj as MethodPropertyDescriptor.MethodPropertyValueHolder;
// if ( mobj.Method.IsVoidMethdod )
// return null;
return mobj.Method.GetChildProperties( null, null );
}
MethodInfo[] methods = type.GetMethods ( BindingFlags.Instance|BindingFlags.InvokeMethod|BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.FlattenHierarchy );
ArrayList methodDesc = new ArrayList();
for ( int i = 0; i < methods.Length; i++ )
{
MethodInfo method = methods[i];
if ( /*method.IsPublic &&*/ !method.IsSpecialName )
{
methodDesc.Add( new MethodPropertyDescriptor( obj, method ) );
}
}
methodDesc.Sort( new MethodNameComparer() );
MethodPropertyDescriptor[] methodsDesc = (MethodPropertyDescriptor[])methodDesc.ToArray ( typeof(MethodPropertyDescriptor));
return new PropertyDescriptorCollection(methodsDesc);
}
示例11: EnsureRelevantMethodsAreVirtual
private void EnsureRelevantMethodsAreVirtual(Type service, Type implementation)
{
if (service.IsInterface) return;
MethodInfo[] methods = implementation.GetMethods(
BindingFlags.Instance|BindingFlags.Public|BindingFlags.DeclaredOnly );
ArrayList problematicMethods = new ArrayList();
foreach( MethodInfo method in methods )
{
if (!method.IsVirtual && method.IsDefined( typeof(PermissionAttribute), true ))
{
problematicMethods.Add( method.Name );
}
}
if (problematicMethods.Count != 0)
{
String[] methodNames = (String[]) problematicMethods.ToArray( typeof(String) );
String message = String.Format( "The class {0} wants to use security interception, " +
"however the methods must be marked as virtual in order to do so. Please correct " +
"the following methods: {1}", implementation.FullName, String.Join(", ", methodNames) );
throw new FacilityException(message);
}
}
示例12: Initialize
public void Initialize(bool _includeDrafts)
{
// get the list of blogs, determine how many items we will be displaying,
// and then have that drive the view mode
string[] blogIds = BlogSettings.GetBlogIds();
int itemCount = (_includeDrafts ? 1 : 0) + 1 + blogIds.Length;
_showLargeIcons = itemCount <= 5;
// configure owner draw
DrawMode = DrawMode.OwnerDrawFixed;
SelectionMode = SelectionMode.One;
HorizontalScrollbar = false;
IntegralHeight = false;
ItemHeight = CalculateItemHeight(_showLargeIcons);
// populate list
if (_includeDrafts)
_draftsIndex = Items.Add(new PostSourceItem(new LocalDraftsPostSource(), this));
_recentPostsIndex = Items.Add(new PostSourceItem(new LocalRecentPostsPostSource(), this));
ArrayList blogs = new ArrayList();
foreach (string blogId in BlogSettings.GetBlogIds())
{
blogs.Add(new PostSourceItem(Res.Get(StringId.Blog), new RemoteWeblogBlogPostSource(blogId), this));
}
blogs.Sort();
Items.AddRange(blogs.ToArray());
}
示例13: GetSelectableNames
public string[] GetSelectableNames(string prefixText)
{
ArrayList items = new ArrayList();
Encoding e = Encoding.GetEncoding("shift_jis");
string str = HttpUtility.UrlEncode(prefixText, e);
XmlDocument document = new XmlDocument();
XmlReader reader = XmlReader.Create("http://api.kakaku.com/Ver1/ItemSearch.asp?Keyword=" + str + "&CategoryGroup=ALL&ResultSet=medium&SortOrder=popularityrank&PageNum=1");
document.Load(reader);
XmlNodeList nodeList = document.SelectNodes(@"/ProductInfo/Item");
foreach (XmlNode node in nodeList)
{
ProductItem productItem = new ProductItem();
foreach (XmlNode attrnode in node)
{
switch (attrnode.Name)
{
case "ProductID":
productItem.ProductID = attrnode.InnerText;
break;
case "ProductName":
productItem.ProductName = attrnode.InnerText;
break;
}
}
items.Add(productItem.ProductID + ": " + productItem.ProductName);
}
return (String[])items.ToArray(typeof(String));
}
示例14: WebsiteInstaller
public WebsiteInstaller()
{
InstallerInfo info = InstallerInfo.GetInstallerInfo();
// Add a default one that we can always fall back to
EventLogInstaller myEventLogInstaller = new EventLogInstaller();
myEventLogInstaller.Source = InstallerInfo.DefaultEventLogSource;
Installers.Add(myEventLogInstaller);
foreach (EventLogInfo source in info.EventLogInfos)
{
myEventLogInstaller = new EventLogInstaller();
myEventLogInstaller.Source = source.Source;
Installers.Add(myEventLogInstaller);
}
foreach (PerformanceCounterCategoryInfo performanceCounter in info.PerformanceCounterCategoryInfos)
{
PerformanceCounterInstaller myCounterInstaller = new PerformanceCounterInstaller();
myCounterInstaller.CategoryHelp = performanceCounter.CategoryHelp;
myCounterInstaller.CategoryName = performanceCounter.CategoryName;
ArrayList counters = new ArrayList();
foreach (CounterCreationDataInfo creationDataInfo in performanceCounter.CounterCreationDataInfos)
counters.Add(new CounterCreationData(creationDataInfo.CounterName, creationDataInfo.CounterHelp,
creationDataInfo.CounterType));
myCounterInstaller.Counters.AddRange(
(CounterCreationData[]) counters.ToArray(typeof (CounterCreationData)));
Installers.Add(myCounterInstaller);
}
}
示例15: SelectLightmapUsers
private void SelectLightmapUsers(object userData, string[] options, int selected)
{
int num = (int)userData;
ArrayList arrayList = new ArrayList();
MeshRenderer[] array = UnityEngine.Object.FindObjectsOfType(typeof(MeshRenderer)) as MeshRenderer[];
MeshRenderer[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
MeshRenderer meshRenderer = array2[i];
if (meshRenderer != null && meshRenderer.lightmapIndex == num)
{
arrayList.Add(meshRenderer.gameObject);
}
}
Terrain[] array3 = UnityEngine.Object.FindObjectsOfType(typeof(Terrain)) as Terrain[];
Terrain[] array4 = array3;
for (int j = 0; j < array4.Length; j++)
{
Terrain terrain = array4[j];
if (terrain != null && terrain.lightmapIndex == num)
{
arrayList.Add(terrain.gameObject);
}
}
Selection.objects = (arrayList.ToArray(typeof(UnityEngine.Object)) as UnityEngine.Object[]);
}