public override int GetHashCode() { unchecked { var hash = 17; hash = hash * 23 + Fields.GetHashCode(); hash = hash * 23 + Properties.GetHashCode(); hash = hash * 23 + Methods.GetHashCode(); hash = hash * 23 + Constructors.GetHashCode(); hash = hash * 23 + Gettable.GetHashCode(); hash = hash * 23 + Settable.GetHashCode(); hash = hash * 23 + Indexers.GetHashCode(); hash = hash * 23 + Events.GetHashCode(); hash = hash * 23 + Inherited.GetHashCode(); hash = hash * 23 + Targeted.GetHashCode(); hash = hash * 23 + NonTargeted.GetHashCode(); hash = hash * 23 + Public.GetHashCode(); hash = hash * 23 + NonPublic.GetHashCode(); hash = hash * 23 + ReadOnly.GetHashCode(); hash = hash * 23 + WriteOnly.GetHashCode(); hash = hash * 23 + Extensions.GetHashCode(); hash = hash * 23 + Operators.GetHashCode(); hash = hash * 23 + Conversions.GetHashCode(); hash = hash * 23 + Parameters.GetHashCode(); hash = hash * 23 + Obsolete.GetHashCode(); hash = hash * 23 + OpenConstructedGeneric.GetHashCode(); hash = hash * 23 + TypeInitializers.GetHashCode(); return(hash); } }
public static Settable <T> GetPropertySettable <T>(this ProjectXElement projectXElement, string propertyElementName, Func <string, T> propertyValueFromString) { var hasProperty = projectXElement.HasProperty(out var propertyValue, propertyElementName, propertyValueFromString); var propertySettable = Settable <T> .New(propertyValue, hasProperty); return(propertySettable); }
public static Settable <string> GetSdkSettable(this ProjectXElement projectXElement) { var hasSdk = projectXElement.HasSdk(out var sdk); var sdkSettable = Settable <string> .New(sdk, hasSdk); return(sdkSettable); }
/// <summary> /// Assigns a value to this <see cref="Settable{T}" /> instance by copying the value /// of another instance, if the other instance has a value. /// </summary> /// <param name="other">The other instance.</param> public void Set(Settable <T> other) { // set only if has value else don't change anything if (other.HasValue) { Set(other.Value); } }
public override string ToString() { StringBuilder sb = new StringBuilder("ReadableBlobMeta("); sb.Append("Settable: "); sb.Append(Settable == null ? "<null>" : Settable.ToString()); sb.Append(",Version: "); sb.Append(Version); sb.Append(")"); return(sb.ToString()); }
public static void SetSdkSettable(this ProjectXElement projectXElement, Settable <string> sdkSettable) { if (sdkSettable.IsSet) { var sdkAttribute = projectXElement.Value.AcquireAttribute(ProjectFileXmlElementName.Sdk); sdkAttribute.Value = sdkSettable.Value; } else { projectXElement.Value.RemoveAttribute(ProjectFileXmlElementName.Sdk); } }
private async Task <bool> CompareSettable <T>(Settable <T> settableX, Settable <T> settableY, IMessageSink messageSink, string propertyName) { var areEqual = settableX == settableY; if (!areEqual) { var message = $"{propertyName} values are not equal:\nX:{settableX}\nY:{settableY}"; await messageSink.AddErrorMessageAsync(this.NowUtcProvider, message); } return(areEqual); }
public void Write(TProtocol oprot) { TStruct struc = new TStruct("ReadableBlobMeta"); oprot.WriteStructBegin(struc); TField field = new TField(); field.Name = "settable"; field.Type = TType.Struct; field.ID = 1; oprot.WriteFieldBegin(field); Settable.Write(oprot); oprot.WriteFieldEnd(); field.Name = "version"; field.Type = TType.I64; field.ID = 2; oprot.WriteFieldBegin(field); oprot.WriteI64(Version); oprot.WriteFieldEnd(); oprot.WriteFieldStop(); oprot.WriteStructEnd(); }
public void TestInequality(Settable<int> a, Settable<int> b, bool expected) { Assert.That(a != b, Is.EqualTo(!expected)); }
public void ResetValue() { i = default(Settable<int>); }
public void TestUndefinedSerialization(Settable<int> a, Settable<int> b, String expectedJson) { var json = JsonConvert.SerializeObject(new { A = a, B = b }, settings); Assert.That(json, Is.EqualTo(expectedJson)); }
public void TestNullValue() { i = null; Assert.That(i.IsSet, Is.True); Assert.That(i.HasValue, Is.False); Assert.Throws<InvalidOperationException>(() => { var a = i.Value; }); }
public void TestIntValues() { i = 10; Assert.That(i.IsSet, Is.True); Assert.That(i.HasValue, Is.True); Assert.That(i.Value, Is.EqualTo(10)); }
public static void SetPropertySettable <T>(this ProjectXElement projectXElement, Settable <T> settable, string propertyElementName, Func <T, string> propertyValueToString) { if (settable.IsSet) { var xPropertyXElement = projectXElement.AcquirePropertyElement(propertyElementName); xPropertyXElement.Value = propertyValueToString(settable.Value); } else { projectXElement.RemovePropertyElement(propertyElementName); } }
static void Main(string[] args) { var a = new Settable <string>(); a = "apple"; }
static Dictionary <SetType, Settable> SettableList = new Dictionary <SetType, Settable>();//SetType으로 Settable을 찾고싶다면 이걸 Dictionary로 public static Settable <T> GetSettable <T>(this SetType type) where T : struct { Settable <T> st = GetSettable(type) as Settable <T>; return(st); }