Equals() private method

private Equals ( Object obj ) : bool
obj Object
return bool
コード例 #1
0
 public void selectService(Enum id)
 {
     if (id.Equals(SocialServices.FACEBOOK))
     {
         selectedService = facebook;
     }
     else if (id.Equals(SocialServices.GOOGLE_PLUS))
     {
         selectedService = googlePlus;
     }
     else
     {
         throw new Exception ("MultiSocialService received unrecognized service id.");
     }
 }
コード例 #2
0
 public static IEnumerable <SelectListItem> ToSelectList <T>(this System.Enum enumValue)
 {
     return
         (System.Enum.GetValues(enumValue.GetType()).Cast <T>()
          .Select(
              x =>
              new SelectListItem
     {
         Text = ((System.Enum)(object) x).ToDescription(),
         Value = x.ToString(),
         Selected = (enumValue.Equals(x))
     }));
 }
コード例 #3
0
	static int Equals(IntPtr L)
	{
		try
		{
			ToLua.CheckArgsCount(L, 2);
			System.Enum obj = (System.Enum)ToLua.CheckObject(L, 1, typeof(System.Enum));
			object arg0 = ToLua.ToVarObject(L, 2);
			bool o = obj != null ? obj.Equals(arg0) : arg0 == null;
			LuaDLL.lua_pushboolean(L, o);
			return 1;
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
コード例 #4
0
ファイル: ConfigReader.cs プロジェクト: TommyAGK/Flex3
        private void ReadConfig(Enum choice)
        {
            // read the XML file from                       v here
                path = Directory.GetCurrentDirectory() + @"\Dependency\ProfileConfig\ProfileConfig.xml";
                XmlDocument xmldoc = new XmlDocument();
                xmldoc.Load(new StreamReader(path));
                if (xmldoc.DocumentElement == null)
                    {
                    return;
                    }
                var nodeList = xmldoc.DocumentElement.SelectNodes("Server"); // <- This gets the stuff related to servers, all of it

                try
                    {
                    if (choice.Equals(ConfigType.Students)) // if you want to find a students RF data, do this
                        {

                        ConfStrings[0] = nodeList[0].SelectSingleNode("address").InnerText;
                        ConfStrings[1] = nodeList[0].SelectSingleNode("sqldirectory").InnerText;
                        ConfStrings[2] = nodeList[0].SelectSingleNode("table").InnerText;
                        ConfStrings[3] = nodeList[0].SelectSingleNode("dbuser").InnerText;
                        ConfStrings[4] = nodeList[0].SelectSingleNode("dbpass").InnerText;

                        }
                    else
                        {
                        // this is teacher data
                        ConfStrings[0] = nodeList[0].NextSibling.SelectSingleNode("address").InnerText;
                        ConfStrings[1] = nodeList[0].NextSibling.SelectSingleNode("sqldirectory").InnerText;
                        ConfStrings[2] = nodeList[0].NextSibling.SelectSingleNode("table").InnerText;
                        ConfStrings[3] = nodeList[0].NextSibling.SelectSingleNode("dbuser").InnerText;
                        ConfStrings[4] = nodeList[0].NextSibling.SelectSingleNode("dbpass").InnerText;
                        }
                    if (DiagXML)
                        {
                            var str = "XML status: filtilgang og lesning OK";
                        }
                    }
                catch (NullReferenceException e)
                    {
                //TODO Handle exception
                // okay
                        LogThis.Report("ConfigReader",e.StackTrace); // write the error down in the logfile
                    }
        }
コード例 #5
0
ファイル: System_EnumWrap.cs プロジェクト: zhangf911/tolua
    static int Equals(IntPtr L)
    {
        ToLua.CheckArgsCount(L, 2);
        System.Enum obj  = (System.Enum)ToLua.CheckObject(L, 1, typeof(System.Enum));
        object      arg0 = ToLua.ToVarObject(L, 2);
        bool        o;

        try
        {
            o = obj != null?obj.Equals(arg0) : arg0 == null;
        }
        catch (Exception e)
        {
            return(LuaDLL.luaL_error(L, e.Message));
        }

        LuaDLL.lua_pushboolean(L, o);
        return(1);
    }
コード例 #6
0
        static StackObject *Equals_20(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Object @obj = (System.Object) typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Enum instance_of_this_method = (System.Enum) typeof(System.Enum).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.Equals(@obj);

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method ? 1 : 0;
            return(__ret + 1);
        }
コード例 #7
0
ファイル: XmlDataReader.cs プロジェクト: TommyAGK/Flex
        private void ReadConfig(Enum choice)
        {
            // read the XML file from                       v here
                                _path = Directory.GetCurrentDirectory() + @"\Dependency\Config\Config.xml";
                                XmlDocument xmldoc = new XmlDocument();
                                xmldoc.Load(new StreamReader(_path));
                                if (xmldoc.DocumentElement == null)
                                    {
                                        return;
                                    }
                                var nodeList = xmldoc.DocumentElement.SelectNodes("Server"); // <- This gets the stuff related to servers, all of it

                                //Console.WriteLine(nodeList[0].NextSibling.SelectSingleNode("table").InnerText);

                                try
                                    {
                                        if (choice.Equals(ConfigType.Students)) // if you want to find a students RF data, do this
                                            {

                                                ConfStrings[0] = nodeList[0].SelectSingleNode("address").InnerText;
                                                ConfStrings[1] = nodeList[0].SelectSingleNode("sqldirectory").InnerText;
                                                ConfStrings[2] = nodeList[0].SelectSingleNode("table").InnerText;
                                                ConfStrings[3] = nodeList[0].SelectSingleNode("dbuser").InnerText;
                                                ConfStrings[4] = nodeList[0].SelectSingleNode("dbpass").InnerText;

                                            }
                                        else
                                            {
                                                // this is teacher data
                                                ConfStrings[0] = nodeList[0].NextSibling.SelectSingleNode("address").InnerText;
                                                ConfStrings[1] = nodeList[0].NextSibling.SelectSingleNode("sqldirectory").InnerText;
                                                ConfStrings[2] = nodeList[0].NextSibling.SelectSingleNode("table").InnerText;
                                                ConfStrings[3] = nodeList[0].NextSibling.SelectSingleNode("dbuser").InnerText;
                                                ConfStrings[4] = nodeList[0].NextSibling.SelectSingleNode("dbpass").InnerText;
                                            }
                                        if (DiagXML)
                                            {
                                                Speaker sp = new Speaker(Language.Norwegian);
                                                var str = "XML status: filtilgang og lesning OK";
                                                sp.Speak(str, 0);

                                            }
                                    }
                                catch (Exception e)
                                    {
                                        Console.WriteLine(e); // you done f****d up.
                                    }
        }
コード例 #8
0
 /// <summary>
 /// Writes the attribute.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="value">The value.</param>
 /// <param name="defaultValue">The default value.</param>
 protected void WriteAttribute(string name, Enum value, Enum defaultValue)
 {
     if (this.settings.WriteDefaultValues || !value.Equals(defaultValue)) {
         this.writer.WriteAttributeString(name, value.Format());
     }
 }
コード例 #9
0
ファイル: EnumTests.cs プロジェクト: AndreGleichner/corefx
 public static void Equals(Enum e, object obj, bool expected, bool hashExpected)
 {
     Assert.Equal(expected, e.Equals(obj));
     Assert.Equal(e.GetHashCode(), e.GetHashCode());
     if (obj != null)
     {
         Assert.Equal(hashExpected, e.GetHashCode().Equals(obj.GetHashCode()));
     }
 }
コード例 #10
0
ファイル: HtmlElement.cs プロジェクト: NickCorn/Writer
        protected internal void SetEnumAttribute(string attribute, Enum value, Enum defaultValue)
        {
            Debug.Assert(value.GetType().Equals(defaultValue.GetType()));

            if (value.Equals(defaultValue))
            {
                RemoveAttribute(attribute);
            }
            else
            {
                SetAttribute(attribute, value.ToString());
            }
        }
コード例 #11
0
        /// <summary>
        /// Returns true if the given enum instance can map exactly to one of the enum's constants.
        /// This doesn't always happen when using BitField enums.
        /// </summary>
        /// <param name="input">An instance of an enum.</param>
        /// <returns>True, if the instance maps directly to a single enum property, false if otherwise.</returns>
        private static bool DirectlyMapsToEnumConstant(Enum input)
        {
            bool exactMatch = false;

            foreach (var raw in Enum.GetValues(input.GetType()))
            {
                if (input.Equals(raw))
                {
                    exactMatch = true;
                    break;
                }
            }

            return exactMatch;
        }
コード例 #12
0
 public static bool IsOneOf <T>(this System.Enum type, params T[] values)
 {
     //[sk]: do not tested
     return(values.Any(value => type.Equals(value)));
 }
コード例 #13
0
ファイル: Element.cs プロジェクト: ikvm/webmatrix
 protected internal void SetEnumAttribute(string attribute, Enum value, Enum defaultValue)
 {
     if (value.Equals(defaultValue))
     {
         this.RemoveAttribute(attribute);
     }
     else
     {
         this.SetAttribute(attribute, value.ToString(CultureInfo.InvariantCulture));
     }
 }