System.Collections.ArrayList.Add C# (CSharp) Method

Add() public method

public Add ( Object value ) : int
value Object
return int
        public virtual int Add(Object value)
        {
            Contract.Ensures(Contract.Result<int>() >= 0);
            if (_size == _items.Length) EnsureCapacity(_size + 1);
            _items[_size] = value;
            _version++;
            return _size++;
        }

Usage Example

        public IResponse Execute(ICruiseRequest request)
        {
            Hashtable velocityContext = new Hashtable();
            ArrayList links = new ArrayList();
            links.Add(new ServerLink(urlBuilder, request.ServerSpecifier, "Server Log", ActionName));

            ProjectStatusListAndExceptions projects = farmService.GetProjectStatusListAndCaptureExceptions(request.ServerSpecifier,
                request.RetrieveSessionToken());
            foreach (ProjectStatusOnServer projectStatusOnServer in projects.StatusAndServerList)
            {
                DefaultProjectSpecifier projectSpecifier = new DefaultProjectSpecifier(projectStatusOnServer.ServerSpecifier, projectStatusOnServer.ProjectStatus.Name);
                links.Add(new ProjectLink(urlBuilder, projectSpecifier, projectSpecifier.ProjectName, ServerLogProjectPlugin.ActionName));
            }
            velocityContext["projectLinks"] = links;
            if (string.IsNullOrEmpty(request.ProjectName))
            {
                velocityContext["log"] = HttpUtility.HtmlEncode(farmService.GetServerLog(request.ServerSpecifier, request.RetrieveSessionToken()));
            }
            else
            {
                velocityContext["currentProject"] = request.ProjectSpecifier.ProjectName;
                velocityContext["log"] = HttpUtility.HtmlEncode(farmService.GetServerLog(request.ProjectSpecifier, request.RetrieveSessionToken()));
            }

            return viewGenerator.GenerateView(@"ServerLog.vm", velocityContext);
        }
All Usage Examples Of System.Collections.ArrayList::Add