System.Net.WebClient.OpenRead C# (CSharp) Method

OpenRead() public method

public OpenRead ( System address ) : System.IO.Stream
address System
return System.IO.Stream
        public System.IO.Stream OpenRead(System.Uri address) { throw null; }
        public void OpenReadAsync(System.Uri address) { }

Same methods

WebClient::OpenRead ( string address ) : System.IO.Stream

Usage Example

        /// <summary>
        /// Looks up a champion with the specified id.
        /// </summary>
        /// <param name="region">The region to check</param>
        /// <param name="championId">id of the champion to look up</param>
        /// <remarks>Version 1.2</remarks>
        /// <returns></returns>
        public Champion GetChampion(int championId)
        {
            Champion championCall = new Champion();
            Champion staticChampionCall = new Champion();

            DataContractJsonSerializer jSerializer = new DataContractJsonSerializer(typeof(Champion));
            WebClient webClient = new WebClient();
            try
            {
                championCall = (Champion)jSerializer.ReadObject(webClient.OpenRead(String.Format("https://{0}.api.pvp.net/api/lol/{0}/v1.2/champion/{1}?api_key={2}", _region, championId, _apiKey)));
                staticChampionCall = (Champion)jSerializer.ReadObject(webClient.OpenRead(string.Format("https://{0}.api.pvp.net/api/lol/static-data/{0}/v1.2/champion/{1}?champData=all&api_key={2}", _region, championId, _apiKey)));

                staticChampionCall.Active = championCall.Active;
                staticChampionCall.BotEnabled = championCall.BotEnabled;
                staticChampionCall.BotMmEnabled = championCall.BotMmEnabled;
                staticChampionCall.FreeToPlay = championCall.FreeToPlay;
                staticChampionCall.RankedPlayEnabled = championCall.RankedPlayEnabled;

            }
            catch (WebException e)
            {
                throw;
            }
            return staticChampionCall;
        }
All Usage Examples Of System.Net.WebClient::OpenRead