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


C# String.Equals方法代码示例

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


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

示例1: BaseAxisQuery

        internal BaseAxisQuery(
                              IQuery qyInput,
                              String Name,
                              String Prefix,
                              String urn,
                              XPathNodeType Type) {
            m_Prefix = Prefix;
            m_URN = urn;
            m_qyInput = qyInput;
            m_Name = Name;
            m_Type = Type;
            _fMatchName = !m_Prefix.Equals(String.Empty) || !m_Name.Equals(String.Empty);

        }
开发者ID:ArildF,项目名称:masters,代码行数:14,代码来源:baseaxisquery.cs

示例2: StrongName

        public StrongName( StrongNamePublicKeyBlob blob, String name, Version version )
        {
            if (name == null)
                throw new ArgumentNullException( "name" );
            if (name.Equals( "" ))
                throw new ArgumentException( Environment.GetResourceString( "Argument_EmptyStrongName" ) );      

            if (blob == null)
                throw new ArgumentNullException( "blob" );

            if (version == null)
                throw new ArgumentNullException( "version" );

            m_publicKeyBlob = blob;
            m_name = name;
            m_version = version;
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:17,代码来源:strongname.cs

示例3: ArgumentNullException

        //
        // Public methods and properties
        // 


        /// <devdoc>
        ///    <para> Default property.
        ///       Indexed property indicating that a cache should (or should not) vary according
        ///       to a custom header.</para>
        /// </devdoc>
        public bool this[String header]
        {
            get {
                if (header == null) {
                    throw new ArgumentNullException("header");
                }

                if (header.Length == 0) {
                    return _ignoreParams == 1;
                }
                else {
                    return _paramsStar || 
                           (_parameters != null && _parameters.GetValue(header) != null);
                }
            }

            set {
                if (header == null) {
                    throw new ArgumentNullException("header");
                }

                if (header.Length == 0) {
                    IgnoreParams = value;
                }
                /*
                 * Since adding a Vary parameter is more restrictive, we don't
                 * want components to be able to set a Vary parameter to false
                 * if another component has set it to true.
                 */
                else if (value) {
                    _isModified = true;
                    _ignoreParams = 0;
                    if (header.Equals("*")) {
                        _paramsStar = true;
                        _parameters = null;
                    }
                    else {
                        // set value to header if true or null if false
                        if (!_paramsStar) {
                            if (_parameters == null) {
                                _parameters = new HttpDictionary();
                            }

                            _parameters.SetValue(header, header);
                        }
                    }
                }
            }
        }
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:59,代码来源:HttpCacheParams.cs

示例4: ArgumentNullException

        /*
         * Vary by a given header
         */

        /// <devdoc>
        ///    <para> Default property.
        ///       Indexed property indicating that a cache should (or should not) vary according
        ///       to a custom header.</para>
        /// </devdoc>
        public bool this[String header]
        {
            get {
                if (header == null) {
                    throw new ArgumentNullException("header");
                }

                if (header.Equals("*")) {
                    return _varyStar;
                }
                else {
                    return (_headers != null && _headers.GetValue(header) != null);
                }
            }

            set {
                if (header == null) {
                    throw new ArgumentNullException("header");
                }

                /*
                 * Since adding a Vary header is more restrictive, we don't
                 * want components to be able to set a Vary header to false
                 * if another component has set it to true.
                 */
                if (value == false) {
                    return;
                }

                _isModified = true;

                if (header.Equals("*")) {
                    VaryByUnspecifiedParameters();
                }
                else {
                    // set value to header if true or null if false
                    if (!_varyStar) {
                        if (_headers == null) {
                            _headers = new HttpDictionary();
                        }

                        _headers.SetValue(header, header);
                    }
                }
            }
        }
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:55,代码来源:HttpCacheVary.cs

示例5: ParsePKT

        private static byte[] ParsePKT(String attributeValue)
        {
            if (attributeValue.Equals("null", StringComparison.OrdinalIgnoreCase) || attributeValue == String.Empty)
                return Array.Empty<byte>();

            if (attributeValue.Length != 8 * 2)
                throw new FileLoadException();

            byte[] pkt = new byte[8];
            int srcIndex = 0;
            for (int i = 0; i < 8; i++)
            {
                char hi = attributeValue[srcIndex++];
                char lo = attributeValue[srcIndex++];
                pkt[i] = (byte)((ParseHexNybble(hi) << 4) | ParseHexNybble(lo));
            }
            return pkt;
        }
开发者ID:huamichaelchen,项目名称:corert,代码行数:18,代码来源:AssemblyNameParser.cs

示例6: ThousandsFormatter

        private static String ThousandsFormatter(String input, int precision, NumberFormatInfo nfi)
        {
            String pre = String.Empty;

            if (input.StartsWith(nfi.NegativeSign))
            {
                input = input.Substring(nfi.NegativeSign.Length);
                pre = nfi.NegativeSign;
            }
            if (input.Equals("0"))
            {
                input = String.Empty;
            }
            input = ZeroString(precision - input.Length) + input;

            return pre + GroupFormatDigits(input, nfi.NumberGroupSeparator, nfi.NumberGroupSizes, String.Empty, 0);
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:17,代码来源:BigIntegerToStringTests.cs

示例7: SendKnownResponseHeader

    public override void SendKnownResponseHeader(int index, String value) {
        if (_headersSent)
            throw new HttpException(SR.GetString(SR.Cannot_append_header_after_headers_sent));

        if (index == HttpWorkerRequest.HeaderSetCookie) {
            DisableKernelCache();
        }

        _headers.Append(GetKnownResponseHeaderName(index));
        _headers.Append(": ");
        _headers.Append(value);
        _headers.Append("\r\n");

        if (index == HeaderContentLength)
            _contentLengthSent = true;
        else if (index == HeaderTransferEncoding && (value != null && value.Equals("chunked")))
            _chunked = true;
    }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:18,代码来源:ISAPIWorkerRequest.cs

示例8: OrdinalStartsWith

        internal unsafe bool OrdinalStartsWith(String compareTo, bool ignoreCase)
        {
            if (Length < compareTo.Length)
                return false;

            if (useStackAlloc)
            {
                NullTerminate();
                if (ignoreCase)
                {
                    String s = new String(m_arrayPtr, 0, compareTo.Length);
                    return compareTo.Equals(s, StringComparison.OrdinalIgnoreCase);
                }
                else
                {
                    for (int i = 0; i < compareTo.Length; i++)
                    {
                        if (m_arrayPtr[i] != compareTo[i])
                        {
                            return false;
                        }
                    }
                    return true;
                }
            }
            else
            {
                if (ignoreCase)
                {
                    return m_sb.ToString().StartsWith(compareTo, StringComparison.OrdinalIgnoreCase);
                }
                else
                {
                    return m_sb.ToString().StartsWith(compareTo, StringComparison.Ordinal);
                }
            }
        }
开发者ID:AustinWise,项目名称:corefx,代码行数:37,代码来源:PathHelper.Windows.cs

示例9: ValidateProperty

            public static bool ValidateProperty(String propertyName, String propertyValue)
            {
                bool isPropertyValid = true;
                if (propertyName.Equals("enabled") || propertyName.Equals("visible"))
                {
                    bool val;
                    if (!Boolean.TryParse(propertyValue, out val)) isPropertyValid = false;
                }
                else if (propertyName.Equals("backgroundColor"))
                {
                    try
                    {
                        System.Windows.Media.SolidColorBrush brush;
                        MoSync.Util.ConvertStringToColor(propertyValue, out brush);
                    }
                    catch (InvalidPropertyValueException)
                    {
                        isPropertyValid = false;
                    }
                }
                else if (propertyName.Equals("backgroundGradient"))
                {
                    try
                    {
                        System.Windows.Media.GradientStop firstGradientStop = new System.Windows.Media.GradientStop();
                        System.Windows.Media.GradientStop secondGradientStop = new System.Windows.Media.GradientStop();

                        System.Windows.Media.SolidColorBrush firstBrush;
                        Util.ConvertStringToColor(propertyValue.Split(',')[0], out firstBrush);

                        System.Windows.Media.SolidColorBrush secondBrush;
                        Util.ConvertStringToColor(propertyValue.Split(',')[1], out secondBrush);
                    }
                    catch (InvalidPropertyValueException)
                    {
                        isPropertyValid = false;
                    }
                }

                return isPropertyValid;
            }
开发者ID:jpsmaia,项目名称:MoSync,代码行数:41,代码来源:MoSyncNativeUIWindowsPhone.cs

示例10: AddDependency

        //
        // add a dependency when we encounter a <use var="HTTP_ACCEPT_LANGUAGE" as="lang" />
        //
        public void AddDependency(String variable) {
            if (variable.Equals("HTTP_USER_AGENT"))
                variable = String.Empty;

            _variables[variable] = true;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:9,代码来源:HttpCapabilitiesEvaluator.cs

示例11: FillHeader

        [System.Security.SecurityCritical]  // auto-generated 
        internal void FillHeader(String name, Object value) 
        {
            Message.DebugOut("MethodCall::FillHeaders: name: " + (name == null ? "NULL" : name) + "\n"); 
            Message.DebugOut("MethodCall::FillHeaders: Value.GetClass: " + (value == null ? "NULL" : value.GetType().FullName) + "\n");
            Message.DebugOut("MethodCall::FillHeaders: Value.ToString: " + (value == null ? "NULL" : value.ToString()) + "\n");

            if (name.Equals("__MethodName")) 
            {
                methodName = (String) value; 
            } 
            else if (name.Equals("__Uri"))
            { 
                uri = (String) value;
            }
            else if (name.Equals("__MethodSignature"))
            { 
                methodSignature = (Type[]) value;
            } 
            else if (name.Equals("__TypeName")) 
            {
                typeName = (String) value; 
            }
            else if (name.Equals("__OutArgs"))
            {
                outArgs = (Object[]) value; 
            }
            else if (name.Equals("__CallContext")) 
            { 
                // if the value is a string, then its the LogicalCallId
                if (value is String) 
                {
                    callContext = new LogicalCallContext();
                    callContext.RemotingData.LogicalCallID = (String) value;
                } 
                else
                    callContext = (LogicalCallContext) value; 
            } 
            else if (name.Equals("__Return"))
            { 
                retVal = value;
            }
            else
            { 
                if (InternalProperties == null)
                { 
                    InternalProperties = new Hashtable(); 
                }
                InternalProperties[name] = value; 
            }
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:51,代码来源:Message.cs

示例12: FillSpecialHeader

        internal override bool FillSpecialHeader(String key, Object value) 
        {
            if (key == null) 
            { 
                //skip
            } 
            else if (key.Equals("__ActivationType"))
            {
                Contract.Assert(value==null, "Phoney type in CCM");
                _activationType = null; 
            }
            else if (key.Equals("__ContextProperties")) 
            { 
                _contextProperties = (IList) value;
            } 
            else if (key.Equals("__CallSiteActivationAttributes"))
            {
                _callSiteActivationAttributes = (Object[]) value;
            } 
            else if (key.Equals("__Activator"))
            { 
                _activator = (IActivator) value; 
            }
            else if (key.Equals("__ActivationTypeName")) 
            {
                _activationTypeName = (String) value;
            }
            else 
            {
                return base.FillSpecialHeader(key, value); 
            } 
            return true;
 
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:34,代码来源:Message.cs

示例13: MapPath

        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public override String MapPath(String path) {
            if (!_hasRuntimeInfo)
                return null;

            String mappedPath = null;
            String appPath = _appPhysPath.Substring(0, _appPhysPath.Length-1); // without trailing "\"

            if (String.IsNullOrEmpty(path) || path.Equals("/")) {
                mappedPath = appPath;
            }
            if (StringUtil.StringStartsWith(path, _appVirtPath)) {
                mappedPath = appPath + path.Substring(_appVirtPath.Length).Replace('/', '\\');
            }

            InternalSecurityPermissions.PathDiscovery(mappedPath).Demand();
            return mappedPath;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:20,代码来源:SimpleWorkerRequest.cs

示例14: AddDateWordOrPostfix

        ////////////////////////////////////////////////////////////////////////////
        // 
        // A helper to add the found date word or month postfix into ArrayList for date words.
        // 
        // Parameters: 
        //      formatPostfix: What kind of postfix this is.
        //          Possible values: 
        //              null: This is a regular date word
        //              "MMMM": month postfix
        //      word: The date word or postfix to be added.
        // 
        ////////////////////////////////////////////////////////////////////////////
        internal void AddDateWordOrPostfix(String formatPostfix, String str) 
        { 
            if (str.Length > 0)
            { 
                // Some cultures use . like an abbreviation
                if (str.Equals("."))
                {
                    AddIgnorableSymbols("."); 
                    return;
                } 
                String words; 
                if (KnownWords.TryGetValue(str, out words) == false)
                { 
                    if (m_dateWords == null)
                    {
                        m_dateWords = new List<String>();
                    } 
                    if (formatPostfix == "MMMM")
                    { 
                        // Add the word into the ArrayList as "\xfffe" + real month postfix. 
                        String temp = MonthPostfixChar + str;
                        if (!m_dateWords.Contains(temp)) 
                        {
                            m_dateWords.Add(temp);
                        }
                    } else 
                    {
                        if (!m_dateWords.Contains(str)) 
                        { 
                            m_dateWords.Add(str);
                        } 
                        if (str[str.Length - 1] == '.')
                        {
                            // Old version ignore the trialing dot in the date words. Support this as well.
                            String strWithoutDot = str.Substring(0, str.Length - 1); 
                            if (!m_dateWords.Contains(strWithoutDot))
                            { 
                                m_dateWords.Add(strWithoutDot); 
                            }
 
                        }
                    }
                }
            } 

        } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:58,代码来源:DateTimeFormatInfoScanner.cs

示例15: Get

 public Model.Pessoa Get(String u, String p)
 {
     return u.Equals("AGNALDO") && p.Equals("[email protected]")
         ? new Model.Pessoa() { Codigo = 1, Nome = "ADÃO" }
         : null;
 }
开发者ID:50minutos,项目名称:MOC-10264-ORACLE,代码行数:6,代码来源:Program.cs


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