当前位置: 首页>>代码示例>>C#>>正文


C# Uri.ThrowIfNull方法代码示例

本文整理汇总了C#中System.Uri.ThrowIfNull方法的典型用法代码示例。如果您正苦于以下问题:C# Uri.ThrowIfNull方法的具体用法?C# Uri.ThrowIfNull怎么用?C# Uri.ThrowIfNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Uri的用法示例。


在下文中一共展示了Uri.ThrowIfNull方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FtpFileSystem

        /// <summary>
        /// Initializes a new instance of the <see cref="FtpFileSystem"/> class.
        /// </summary>
        /// <param name="serverAddress">The server address.</param>
        /// <param name="credentials">The credentials.</param>
        public FtpFileSystem(Uri serverAddress, NetworkCredential credentials)
        {
            serverAddress.ThrowIfNull(() => serverAddress);
            credentials.ThrowIfNull(() => credentials);

            this.client = new FtpClient(credentials);
        }
开发者ID:dineshkummarc,项目名称:FlagSync,代码行数:12,代码来源:FtpFileSystem.cs

示例2: ConnectionSettings

        public ConnectionSettings(Uri uri, string defaultIndex)
        {
            uri.ThrowIfNull("uri");
            defaultIndex.ThrowIfNullOrEmpty("defaultIndex");

            this.Timeout = 60 * 1000;

            this.SetDefaultIndex(defaultIndex);
            this.Uri = uri;

            if (!uri.OriginalString.EndsWith("/"))
                this.Uri = new Uri(uri.OriginalString + "/");
            this.Host = uri.Host;
            this.Port = uri.Port;
            this.UriSpecifiedBasicAuth = !uri.UserInfo.IsNullOrEmpty();

            this.MaximumAsyncConnections = 0;
            this.DefaultTypeNameInferrer = (t => t.Name.ToLower());
            this.DefaultIndices = new FluentDictionary<Type, string>();
            this.DefaultTypeNames = new FluentDictionary<Type, string>();
            this.ConnectionStatusHandler = this.ConnectionStatusDefaultHandler;

            this.ModifyJsonSerializerSettings = (j) => { };
            this.ContractConverters = Enumerable.Empty<Func<Type, JsonConverter>>().ToList().AsReadOnly();
        }
开发者ID:v-kovrigin,项目名称:NEST,代码行数:25,代码来源:ConnectionSettings.cs

示例3: ConnectionSettings

        /// <summary>
        /// Instantiate a connectionsettings object to tell the client where and how to connect to elasticsearch
        /// using a proxy
        /// </summary>
        /// <param name="uri">A Uri to describe the elasticsearch endpoint</param>
        /// <param name="timeout">time out in milliseconds</param>
        /// <param name="proxyAddress">proxy address</param>
        /// <param name="username">proxy username</param>
        /// <param name="password">proxy password</param>
        public ConnectionSettings(Uri uri, int timeout, string proxyAddress, string username, string password)
        {
            uri.ThrowIfNull("uri");

            this._uri = uri;
            this._password = password;
            this._username = username;
            this._timeout = timeout;
            this._proxyAddress = proxyAddress;
            this.MaximumAsyncConnections = 20;
            this._defaultTypeIndices = new FluentDictionary<Type, string>();
        }
开发者ID:staywellandy,项目名称:NEST,代码行数:21,代码来源:ConnectionSettings.cs

示例4: FactoryParameters

        /// <summary>
        /// Creates a new factory parameter by splitting the specified service URI into ServerUrl and BasePath
        /// </summary>
        public FactoryParameters(Uri serviceUri)
        {
            serviceUri.ThrowIfNull("serviceUri");

            // Retrieve Scheme and Host
            ServerUrl = serviceUri.GetComponents(UriComponents.SchemeAndServer, UriFormat.UriEscaped);
            ServerUrl.ThrowIfNullOrEmpty("ServerUrl");

            // Retrieve the remaining right part
            BasePath = serviceUri.GetComponents(UriComponents.PathAndQuery, UriFormat.UriEscaped);
            ServerUrl.ThrowIfNullOrEmpty("BasePath");
        }
开发者ID:JANCARLO123,项目名称:google-apis,代码行数:15,代码来源:ServiceFactoryImpl.cs

示例5: ConnectionSettings

        public ConnectionSettings(Uri uri)
        {
            uri.ThrowIfNull("uri");

            this.Timeout = 60 * 1000;

            this.Uri = uri;
            if (!uri.ToString().EndsWith("/"))
                this.Uri = new Uri(uri.ToString() + "/");
            this.Host = uri.Host;
            this.Port = uri.Port;

            this.MaximumAsyncConnections = 20;
            this.DefaultTypeNameInferrer = this.LowerCaseAndPluralizeTypeNameInferrer;
            this.DefaultIndices = new FluentDictionary<Type, string>();
            this.DefaultTypeNames = new FluentDictionary<Type, string>();
            this.ConnectionStatusHandler = this.ConnectionStatusDefaultHandler;
        }
开发者ID:Rustemt,项目名称:NEST,代码行数:18,代码来源:ConnectionSettings.cs

示例6: ConnectionSettings

        public ConnectionSettings(Uri uri)
        {
            uri.ThrowIfNull("uri");

            this.Timeout = 60 * 1000;

            this.Uri = uri;
            if (!uri.OriginalString.EndsWith("/"))
                this.Uri = new Uri(uri.OriginalString + "/");
            this.Host = uri.Host;
            this.Port = uri.Port;

            this.MaximumAsyncConnections = 0;
            this.DefaultTypeNameInferrer = this.LowerCaseAndPluralizeTypeNameInferrer;
            this.DefaultIndices = new FluentDictionary<Type, string>();
            this.DefaultTypeNames = new FluentDictionary<Type, string>();
            this.ConnectionStatusHandler = this.ConnectionStatusDefaultHandler;

            this.ModifyJsonSerializerSettings = (j) => { };
            this.ContractConverters = Enumerable.Empty<Func<Type, JsonConverter>>().ToList().AsReadOnly();
        }
开发者ID:nickcanz,项目名称:NEST,代码行数:21,代码来源:ConnectionSettings.cs

示例7: DigestProxyAuthorizationHeader

        private DigestProxyAuthorizationHeader(string authScheme, string username, string realm, string nonce, Uri digestUri, string response, string algorithm, string cnonce, string opaque, string messageQop, string nonceCount)
        {
            authScheme.ThrowIfNull("authScheme");
            username.ThrowIfNull("username");
            realm.ThrowIfNull("realm");
            nonce.ThrowIfNull("nonce");
            digestUri.ThrowIfNull("digestUri");
            response.ThrowIfNull("response");

            _authScheme = authScheme;
            _username = username;
            _realm = realm;
            _nonce = nonce;
            _digestUri = digestUri;
            _response = response;
            _algorithm = algorithm;
            _cnonce = cnonce;
            _opaque = opaque;
            _messageQop = messageQop;
            _nonceCount = nonceCount;
        }
开发者ID:nathan-alden,项目名称:junior-route,代码行数:21,代码来源:DigestProxyAuthorizationHeader.cs

示例8: SetProxy

 /// <summary>
 /// If your connection has to go through proxy use this method to specify the proxy url
 /// </summary>
 /// <returns></returns>
 public ConnectionSettings SetProxy(Uri proxyAdress, string username, string password)
 {
     proxyAdress.ThrowIfNull("proxyAdress");
     this.ProxyAddress = proxyAdress.ToString();
     this.ProxyUsername = username;
     this.ProxyPassword = password;
     return this;
 }
开发者ID:Rustemt,项目名称:NEST,代码行数:12,代码来源:ConnectionSettings.cs

示例9: RefererHeader

        private RefererHeader(Uri url)
        {
            url.ThrowIfNull("url");

            _url = url;
        }
开发者ID:nathan-alden,项目名称:junior-route,代码行数:6,代码来源:RefererHeader.cs


注:本文中的System.Uri.ThrowIfNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。