object.Equals(object)

Here are the examples of the csharp api object.Equals(object) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

4417 Examples 7

19 Source : Configuration.ValueConfig.cs
with GNU Affero General Public License v3.0
from 0ceal0t

private bool DrawCombo(string id, T[] comboOptions, T currentValue, out T value) {
            value = currentValue;
            if (ImGui.BeginCombo(id, $"{currentValue}", ImGuiComboFlags.HeightLargest)) {
                if (ShowSearch) {
                    ImGui.SetNexreplacedemWidth(ImGui.GetWindowContentRegionWidth() - 50);
                    ImGui.InputText("Search##Combo", ref SearchInput, 256);
                }

                if (ShowSearch) ImGui.BeginChild("Child##Combo", new Vector2(ImGui.GetWindowContentRegionWidth(), 200), true);

                var idx = 0;
                foreach (T option in comboOptions) {
                    if (ShowSearch && !string.IsNullOrEmpty(SearchInput)) {
                        var optionString = option.ToString();
                        if (!optionString.ToLower().Contains(SearchInput.ToLower())) continue;
                    }

                    if (ImGui.Selectable($"{option}##Combo{idx}", option.Equals(currentValue))) {
                        value = option;

                        if (ShowSearch) ImGui.EndChild();
                        ImGui.EndCombo();
                        return true;
                    }
                    idx++;
                }

                if (ShowSearch) ImGui.EndChild();
                ImGui.EndCombo();
            }
            return false;
        }

19 Source : ExprTableFullName.cs
with MIT License
from 0x1000000

public override bool Equals(object? obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != this.GetType()) return false;
            return Equals((ExprTableFullName) obj);
        }

19 Source : ColumnRef.cs
with MIT License
from 0x1000000

public override bool Equals(object? obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != this.GetType()) return false;
            return Equals((ColumnRef) obj);
        }

19 Source : ExprAlias.cs
with MIT License
from 0x1000000

public override bool Equals(object? obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != this.GetType()) return false;
            return Equals((ExprAlias) obj);
        }

19 Source : ExprAliasGuid.cs
with MIT License
from 0x1000000

public override bool Equals(object? obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != this.GetType()) return false;
            return this.Equals((ExprAliasGuid) obj);
        }

19 Source : ExprColumn.cs
with MIT License
from 0x1000000

public override bool Equals(object? obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != this.GetType()) return false;
            return this.Equals((ExprColumn) obj);
        }

19 Source : ExprColumnAlias.cs
with MIT License
from 0x1000000

public override bool Equals(object? obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != this.GetType()) return false;
            return Equals((ExprColumnAlias) obj);
        }

19 Source : ExprColumnName.cs
with MIT License
from 0x1000000

public override bool Equals(object? obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != this.GetType()) return false;
            return Equals((ExprColumnName) obj);
        }

19 Source : ExprDatabaseName.cs
with MIT License
from 0x1000000

public override bool Equals(object? obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != this.GetType()) return false;
            return Equals((ExprDatabaseName) obj);
        }

19 Source : ExprDbSchema.cs
with MIT License
from 0x1000000

public override bool Equals(object? obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != this.GetType()) return false;
            return Equals((ExprDbSchema) obj);
        }

19 Source : ExprFunctionName.cs
with MIT License
from 0x1000000

public override bool Equals(object? obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != this.GetType()) return false;
            return Equals((ExprFunctionName) obj);
        }

19 Source : ExprSchemaName.cs
with MIT License
from 0x1000000

public override bool Equals(object? obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != this.GetType()) return false;
            return Equals((ExprSchemaName) obj);
        }

19 Source : ExprTable.cs
with MIT License
from 0x1000000

public override bool Equals(object? obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != this.GetType()) return false;
            return this.Equals((ExprTable) obj);
        }

19 Source : ExprTableAlias.cs
with MIT License
from 0x1000000

public override bool Equals(object? obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != this.GetType()) return false;
            return this.Equals((ExprTableAlias) obj);
        }

19 Source : ExprTableName.cs
with MIT License
from 0x1000000

public override bool Equals(object? obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != this.GetType()) return false;
            return Equals((ExprTableName) obj);
        }

19 Source : IExprTableSource.cs
with MIT License
from 0x1000000

public bool Equals(TableMultiplication other)
        {
            return this.Tables.Equals(other.Tables) && Equals(this.On, other.On);
        }

19 Source : ExprValue.cs
with MIT License
from 0x1000000

public override bool Equals(object? obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != this.GetType()) return false;
            return Equals((ExprValue) obj);
        }

19 Source : TableRef.cs
with MIT License
from 0x1000000

public override bool Equals(object? obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != this.GetType()) return false;
            return Equals((TableRef) obj);
        }

19 Source : CommonExtensions.cs
with MIT License
from 17MKH

public static bool ToBool(this object s)
    {
        if (s == null) 
            return false;

        s = s.ToString().ToLower();
        if (s.Equals(1) || s.Equals("1") || s.Equals("true") || s.Equals("是") || s.Equals("yes"))
            return true;
        if (s.Equals(0) || s.Equals("0") || s.Equals("false") || s.Equals("否") || s.Equals("no"))
            return false;

        Boolean.TryParse(s.ToString(), out bool result);
        return result;
    }

19 Source : RefType.cs
with MIT License
from 3F

public override bool Equals(object obj)
        {
            if(obj is null || !(obj is RefType<T>)) {
                return false;
            }
            return Value.Equals(((RefType<T>)obj).Value);
        }

19 Source : JsonData.cs
with MIT License
from 404Lcc

public bool Equals (JsonData x)
        {
            if (x == null)
                return false;

            if (x.type != this.type)
                return false;

            switch (this.type) {
            case JsonType.None:
                return true;

            case JsonType.Object:
                return this.inst_object.Equals (x.inst_object);

            case JsonType.Array:
                return this.inst_array.Equals (x.inst_array);

            case JsonType.String:
                return this.inst_string.Equals (x.inst_string);

            case JsonType.Int:
                return this.inst_int.Equals (x.inst_int);

            case JsonType.Long:
                return this.inst_long.Equals (x.inst_long);

            case JsonType.Double:
                return this.inst_double.Equals (x.inst_double);

            case JsonType.Boolean:
                return this.inst_boolean.Equals (x.inst_boolean);
            }

            return false;
        }

19 Source : Packet.cs
with MIT License
from 499116344

public override bool Equals(object obj)
        {
            if (obj is Packet packet)
            {
                return Header == packet.Header && Command == packet.Command && Sequence == packet.Sequence;
            }

            return base.Equals(obj);
        }

19 Source : VSCodeGenAccessors.cs
with MIT License
from 6tail

public override bool Equals(object obj) {
        if (typeof(BaseAccessor).IsInstanceOfType(obj)) {
            obj = ((BaseAccessor)(obj)).Target;
        }
        return this.Target.Equals(obj);
    }

19 Source : Beacon.cs
with MIT License
from 5argon

private static bool FindActiveInternal<BEACONTYPE>(BEACONTYPE label, out ILabelBeacon foundBeacon)
        {
            var beacons = UnityEngine.Object.FindObjectsOfType<MonoBehaviour>().OfType<ILabelBeacon>();
            //Debug.Log($"Find active {beacons.Count()}");
            ILabelBeacon testBeacon = null;
            bool found = false;
            foreach (var b in beacons)
            {
                //Debug.Log($"Checking {b.Label} {b.GetType()} vs {label}");
                if (b.Label is BEACONTYPE t && t.Equals(label))
                {
                    if (found)
                    {
                        throw new BeaconException($"Multiple beacons with label {label} found. This is considered an error.");
                    }
                    testBeacon = b;
                    found = true;
                    //Debug.Log($"WE FOUND IT");
                }
            }
            if (!found)
            {
                foundBeacon = null;
                return false;
            }
            else
            {
                foundBeacon = testBeacon;
                return true;
            }
        }

19 Source : ExpressionTree.cs
with MIT License
from 71

public bool Equals(Expression x, Expression y)
            {
                if (x == null)
                    return y == null;
                if (y == null)
                    return false;
                if (x.GetType() != y.GetType())
                    return false;

                if (x is ConstantExpression lc && y is ConstantExpression rc)
                    return lc.Value.Equals(rc.Value);

                return x.Children().SequenceEqual(y.Children(), this);
            }

19 Source : BoxSlider.cs
with MIT License
from 734843327

public static bool SetClreplaced<T>(ref T currentValue, T newValue) where T: clreplaced
		{
			if ((currentValue == null && newValue == null) || (currentValue != null && currentValue.Equals(newValue)))
				return false;
			
			currentValue = newValue;
			return true;
		}

19 Source : AINavMeshGenerator.cs
with MIT License
from 7ark

private Node[] GetAStar(Vector2 currentPosition, Vector2 destination, GameObject obj = null)
    {
        Node start = generator.FindClosestNode(currentPosition, false, obj);
        Node end = generator.FindClosestNode(destination, true, obj);
        if (start == null || end == null)
        {
            return null;
        }

        openSet.Clear();
        closedSet.Clear();
        openSet.Add(start);
        while (openSet.Count > 0)
        {
            Node current = openSet[0];

            //Evaluate costs
            for (int i = 1; i < openSet.Count; i++)
            {
                if (openSet[i].fCost < current.fCost || openSet[i].fCost == current.fCost)
                {
                    if (openSet[i].hCost < current.hCost)
                    {
                        current = openSet[i];
                    }
                }
            }

            openSet.Remove(current);
            closedSet.Add(current);

            if (current.Equals(end))
            {
                break;
            }

            //Go through neighbors
            foreach (Node neighbor in current.connections.Where(x => x != null))
            {
                //The replacedociated object check is so the enemy ignores pathing through it's own bad sector
                if ((!neighbor.valid && neighbor.replacedociatedObject != obj) || closedSet.Contains(neighbor))
                {
                    continue;
                }

                float newCost = current.gCost + Heuristic(current, neighbor);
                if (newCost < neighbor.gCost || !openSet.Contains(neighbor))
                {
                    neighbor.gCost = newCost;
                    neighbor.hCost = Heuristic(neighbor, end);
                    neighbor.parent = current;

                    if (!openSet.Contains(neighbor))
                    {
                        openSet.Add(neighbor);
                    }
                }
            }
        }

        if(end.parent == null)
        {
            return null;
        }

        //Calculate path
        path.Clear();
        Node currentCheck = end;
        while (!path.Contains(currentCheck) && currentCheck != null)
        {
            path.Add(currentCheck);
            currentCheck = currentCheck.parent;
        }
        path.Reverse();
        if(path[0] != start)
        {
            return null;
        }
        return path.ToArray();
    }

19 Source : Framework.LifeCircle.partial.cs
with MIT License
from 7Bytes-Studio

private static void CheckWhoOrThrow(object who)
        {
            if (s_Who != null && !s_Who.Equals(who))
            {
                throw new NullReferenceException("框架活动主体有且只能有一个。");
            }
        }

19 Source : BoolToVisibilityConverter.cs
with MIT License
from 944095635

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return value != null && value.Equals(true) ? parameter : Binding.DoNothing;
        }

19 Source : Vector.cs
with MIT License
from a1q123456

public override bool Equals(object obj)
        {
            if (obj is Vector<T> en)
            {
                return IsFixedSize == en.IsFixedSize && en.SequenceEqual(this);
            }
            return base.Equals(obj);
        }

19 Source : TestAmf3Writer.cs
with MIT License
from a1q123456

public override bool Equals(object obj)
            {
                if (obj is TestCls2 obj2)
                {
                    return Equals(obj2);
                }
                return base.Equals(obj);
            }

19 Source : Amf3ClassTraits.cs
with MIT License
from a1q123456

public override bool Equals(object obj)
        {
            if (obj is Amf3ClreplacedTraits traits)
            {
                Equals(traits);
            }

            return base.Equals(obj);
        }

19 Source : CapTypeOptions.cs
with MIT License
from a1xd

public void CheckIfDefault()
        {
            if (SelectedCapOption.Equals(Default))
            {
                OptionsDropdown.ForeColor = System.Drawing.Color.Gray;
            }
            else
            {
                OptionsDropdown.ForeColor = System.Drawing.Color.Black;
            }
        }

19 Source : Database.cs
with Apache License 2.0
from aadreja

internal virtual bool CreateUpdateCommand(IDbCommand cmd, object enreplacedy, object oldEnreplacedy, IAuditTrail audit = null, string columnNames = null, bool doNotAppendCommonFields = false, bool overrideCreatedUpdatedOn = false)
        {
            bool isUpdateNeeded = false;

            TableAttribute tableInfo = EnreplacedyCache.Get(enreplacedy.GetType());

            if (!tableInfo.NoUpdatedBy && tableInfo.IsUpdatedByEmpty(enreplacedy))
                throw new MissingFieldException("Updated By is required");

            List<string> columns = new List<string>();

            if (!string.IsNullOrEmpty(columnNames)) columns.AddRange(columnNames.Split(','));
            else columns.AddRange(tableInfo.DefaultUpdateColumns);//Get columns from Enreplacedy attributes loaded in TableInfo

            StringBuilder cmdText = new StringBuilder();
            cmdText.Append($"UPDATE {tableInfo.FullName} SET ");

            //add default columns if doesn't exists
            if (!doNotAppendCommonFields)
            {
                if (!tableInfo.NoVersionNo && !columns.Contains(Config.VERSIONNO_COLUMN.Name))
                    columns.Add(Config.VERSIONNO_COLUMN.Name);

                if (!tableInfo.NoUpdatedBy && !columns.Contains(Config.UPDATEDBY_COLUMN.Name))
                    columns.Add(Config.UPDATEDBY_COLUMN.Name);

                if (!tableInfo.NoUpdatedOn && !columns.Contains(Config.UPDATEDON_COLUMN.Name))
                    columns.Add(Config.UPDATEDON_COLUMN.Name);
            }

            //remove primarykey, createdon and createdby columns if exists
            columns.RemoveAll(c => tableInfo.PkColumnList.Select(p=>p.Name).Contains(c));
            columns.RemoveAll(c => c == Config.CREATEDON_COLUMN.Name || 
                                    c == Config.CREATEDBY_COLUMN.Name);

            for (int i = 0; i < columns.Count(); i++)
            {
                if (columns[i].Equals(Config.VERSIONNO_COLUMN.Name, StringComparison.OrdinalIgnoreCase))
                {
                    cmdText.Append($"{columns[i]} = {columns[i]}+1");
                    cmdText.Append(",");
                }
                else if (columns[i].Equals(Config.UPDATEDBY_COLUMN.Name, StringComparison.OrdinalIgnoreCase))
                {
                    cmdText.Append($"{columns[i]} = @{columns[i]}");
                    cmdText.Append(",");
                    cmd.AddInParameter("@" + columns[i], Config.UPDATEDBY_COLUMN.ColumnDbType, tableInfo.GetUpdatedBy(enreplacedy));
                }
                else if (columns[i].Equals(Config.UPDATEDON_COLUMN.Name, StringComparison.OrdinalIgnoreCase))
                {
                    var updatedOn = Helper.GetDateTimeOrDatabaseDateTimeSQL(tableInfo.GetUpdatedOn(enreplacedy), this, overrideCreatedUpdatedOn);
                    if (updatedOn is string)
                    {
                        cmdText.Append($"{columns[i]} = {CURRENTDATETIMESQL}");
                    }
                    else
                    {
                        cmdText.Append($"{columns[i]} = @{columns[i]}");
                        cmd.AddInParameter("@" + columns[i], Config.UPDATEDON_COLUMN.ColumnDbType, updatedOn);
                    }
                    cmdText.Append(",");
                }
                else
                {
                    bool includeInUpdate = true;
                    tableInfo.Columns.TryGetValue(columns[i], out ColumnAttribute columnInfo); //find column attribute

                    DbType dbType = DbType.Object;
                    object columnValue = null;

                    if (columnInfo != null && columnInfo.GetMethod != null)
                    {
                        dbType = columnInfo.ColumnDbType;
                        columnValue = columnInfo.GetAction(enreplacedy);

                        includeInUpdate = oldEnreplacedy == null; //include in update when oldEnreplacedy not available

                        //compare with old object to check whether update is needed or not
                        object oldColumnValue = null;
                        if (oldEnreplacedy != null)
                        {
                            oldColumnValue = columnInfo.GetAction(oldEnreplacedy);

                            if (oldColumnValue != null && columnValue != null)
                            {
                                if (!oldColumnValue.Equals(columnValue)) //add to history only if property is modified
                                {
                                    includeInUpdate = true;
                                }
                            }
                            else if (oldColumnValue == null && columnValue != null)
                            {
                                includeInUpdate = true;
                            }
                            else if (oldColumnValue != null)
                            {
                                includeInUpdate = true;
                            }
                        }

                        if (tableInfo.NeedsHistory && includeInUpdate) audit.AppendDetail(columns[i], columnValue, dbType, oldColumnValue);
                    }

                    if (includeInUpdate)
                    {
                        isUpdateNeeded = true;

                        cmdText.Append($"{columns[i]} = @{columns[i]}");
                        cmdText.Append(",");
                        cmd.AddInParameter("@" + columns[i], dbType, columnValue);
                    }
                }
            }
            cmdText.RemoveLastComma(); //Remove last comma if exists

            cmdText.Append(" WHERE ");
            if (tableInfo.PkColumnList.Count > 1)
            {
                int index = 0;
                foreach (ColumnAttribute pkCol in tableInfo.PkColumnList)
                {
                    cmdText.Append($" {(index > 0 ? " AND " : "")} {pkCol.Name}=@{pkCol.Name}");
                    cmd.AddInParameter("@" + pkCol.Name, pkCol.ColumnDbType, tableInfo.GetKeyId(enreplacedy, pkCol));
                    index++;
                }
            }
            else
            {
                cmdText.Append($" {tableInfo.PkColumn.Name}=@{tableInfo.PkColumn.Name}");
                cmd.AddInParameter("@" + tableInfo.PkColumn.Name, tableInfo.PkColumn.ColumnDbType, tableInfo.GetKeyId(enreplacedy));
            }

            if (Config.DbConcurrencyCheck && !tableInfo.NoVersionNo)
            {
                cmdText.Append($" AND {Config.VERSIONNO_COLUMN.Name}=@{Config.VERSIONNO_COLUMN.Name}");
                cmd.AddInParameter("@" + Config.VERSIONNO_COLUMN.Name, Config.VERSIONNO_COLUMN.ColumnDbType, tableInfo.GetVersionNo(enreplacedy));
            }

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = cmdText.ToString();

            return isUpdateNeeded;
        }

19 Source : ConversionHelper.cs
with MIT License
from abdullin

[NotNull]
		private static Func<object, object, bool> CreateTypeComparator([NotNull] Type t1, [NotNull] Type t2)
		{
			Contract.Requires(t1 != null && t2 != null);

			// note: the most common scenarios will be when we compare 'A' to "A", or (int)123 to (long)123, Guids in string or System.Guid form, ...
			// We should not try too hard to compare complex objects (what about dates ? timespans? Guids?)

			// first, handle the easy cases
			if (AreEquivalentTypes(t1, t2))
			{
				switch (Type.GetTypeCode(t1))
				{
					case TypeCode.Char: return (x, y) => (char)x == (char)y;
					case TypeCode.Byte: return (x, y) => (byte)x == (byte)y;
					case TypeCode.SByte: return (x, y) => (sbyte)x == (sbyte)y;
					case TypeCode.Int16: return (x, y) => (short)x == (short)y;
					case TypeCode.UInt16: return (x, y) => (ushort)x == (ushort)y;
					case TypeCode.Int32: return (x, y) => (int)x == (int)y;
					case TypeCode.UInt32: return (x, y) => (uint)x == (uint)y;
					case TypeCode.Int64: return (x, y) => (long)x == (long)y;
					case TypeCode.UInt64: return (x, y) => (ulong)x == (ulong)y;
					case TypeCode.Single: return (x, y) => (float)x == (float)y;
					case TypeCode.Double: return (x, y) => (double)x == (double)y;
					case TypeCode.String: return (x, y) => (string)x == (string)y;
				}

				return (x, y) =>
				{
					if (object.ReferenceEquals(x, null)) return object.ReferenceEquals(y, null);
					return object.ReferenceEquals(x, y) || x.Equals(y);
				};
			}

			if (IsStringType(t1) || IsStringType(t2))
			{
				return (x, y) =>
				{
					if (x == null) return y == null;
					if (y == null) return false;
					return object.ReferenceEquals(x, y) || (TryAdaptToString(x) == TryAdaptToString(y));
				};
			}

			if (IsNumericType(t1) || IsNumericType(t2))
			{
				if (IsDecimalType(t1) || IsDecimalType(t2))
				{
					return (x, y) =>
					{
						double d1, d2;
						return x == null ? y == null : y != null && TryAdaptToDecimal(x, t1, out d1) && TryAdaptToDecimal(y, t2, out d2) && d1 == d2;
					};
				}
				else
				{
					//TODO: handle UInt64 with values > long.MaxValue that will overflow to negative values when casted down to Int64
					return (x, y) =>
					{
						long l1, l2;
						return x == null ? y == null : y != null && TryAdaptToInteger(x, t1, out l1) && TryAdaptToInteger(y, t2, out l2) && l1 == l2;
					};
				}
			}

			//TODO: some other way to compare ?
			return (x, y) => false;
		}

19 Source : ServiceId.cs
with MIT License
from abdullin

public bool Equals(T x, T y) {
            return _selector(x).Equals(_selector(y));
        }

19 Source : BaseGenericInputSource.cs
with Apache License 2.0
from abist-co-ltd

bool IEqualityComparer.Equals(object left, object right)
        {
            return left.Equals(right);
        }

19 Source : BaseSpatialObserver.cs
with Apache License 2.0
from abist-co-ltd

bool IEqualityComparer.Equals(object x, object y)
        {
            return x.Equals(y);
        }

19 Source : BaseControllerPointer.cs
with Apache License 2.0
from abist-co-ltd

bool IEqualityComparer.Equals(object left, object right)
        {
            return left != null && left.Equals(right);
        }

19 Source : FastList.cs
with MIT License
from absurd-joy

public bool Remove(T item) {
        if (array != null) {
            for (int i = 0; i < size; i++) {
                if (item.Equals(array[i])) { //found it, push everything up
                    size--;
                    for (int j = i; j < size; j++) {
                        array[j] = array[j+1];
                    }
                    array[size] = default(T);
                    return true;
                }
            }
        }
        return false;
    }

19 Source : FastList.cs
with MIT License
from absurd-joy

public bool RemoveFast(T item) {
        if (array != null) {
            for (int i = 0; i < size; i++) {
				if ( item.Equals( array[i] )) { //found
                    //Move last item here
                    if (i < (size - 1)) {
                        T lasreplacedem = array[size-1];
                        array[size-1] = default(T);
                        array[i] = lasreplacedem;
                    } else {
                        array[i] = default(T);
                    }
                    size--;
                    return true;
                }
            }
        }
        return false;
    }

19 Source : FastList.cs
with MIT License
from absurd-joy

public bool Contains(T item) {
        if (array == null || size <= 0 ) return false;
        for (int i = 0; i < size; i++) {
            if (array[i].Equals(item)) { return true;}
        }
        return false;
    }

19 Source : FastList.cs
with MIT License
from absurd-joy

public int IndexOf(T item) {
        if (size <= 0 || array == null) { return -1;}
        for (int i = 0; i < size; i++) {
            if (item.Equals(array[i])) { return i;}
        }
        return -1;
    }

19 Source : RealtimeWaterfall3DChart.xaml.cs
with MIT License
from ABTSoftware

private void SelectedTypeChanged(object sender, SelectionChangedEventArgs e)
        {
            var isWaterfallRunning = e.AddedItems[0].Equals("Waterfall");

            if (WaterfallSeries != null && MeshSeries != null)
            {
                WaterfallSeries.IsVisible = isWaterfallRunning;
                MeshSeries.IsVisible = !isWaterfallRunning;
                CTRLButton.IsEnabled = isWaterfallRunning;
            }
        }

19 Source : RendererTypeToDisplayNameConverter.cs
with MIT License
from ABTSoftware

public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
                return false;

            return value.Equals(parameter);
        }

19 Source : VisibleIfTypeConverter.cs
with MIT License
from ABTSoftware

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null && Value == null) return true;

            if (value != null && value.Equals(Value)) return true;

            return false;
        }

19 Source : StrongTyped.cs
with MIT License
from ABTSoftware

public override bool Equals(object obj)
        {
            return base.Equals(obj);
        }

19 Source : Equality.cs
with Apache License 2.0
from acblog

public void Add<T>(T a, T b)
        {
            if (a is null && b is null)
            {
                return;
            }
            if (a is null || b is null)
                ThrowNeq();
            if (!a.Equals(b))
                ThrowNeq();
        }

19 Source : Sequence.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void apricot()
        {
            var node = AnimList.First;
            while (!node.Equals(CurrAnim))
            {
                if (node.Equals(FirstCyclic))
                    break;

                AnimList.Remove(node);
                node = AnimList.First;
            }
        }

19 Source : Sequence.cs
with GNU Affero General Public License v3.0
from ACEmulator

public void remove_all_link_animations()
        {
            while (FirstCyclic != null && FirstCyclic.Previous != null)
            {
                if (CurrAnim.Equals(FirstCyclic.Previous))
                {
                    CurrAnim = FirstCyclic;
                    if (CurrAnim != null)
                        FrameNumber = CurrAnim.Value.get_starting_frame();
                }
                AnimList.Remove(FirstCyclic.Previous);
            }
        }

See More Examples