Commit f67a8682 authored by 彭伟's avatar 彭伟 Committed by Lemon

Add implicit convert (#187)

* Add general host

* Add sign

* Add implicit convert
parent 10b7aaba
/*
/*
* Licensed to the SkyAPM under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
......@@ -32,7 +32,7 @@ namespace SkyApm.Common
public bool HasValue => HasIntValue || HasStringValue;
public bool HasIntValue => _intValue != 0;
public bool HasStringValue => _stringValue != null;
public StringOrIntValue(string value)
......@@ -48,9 +48,9 @@ namespace SkyApm.Common
}
public int GetIntValue() => _intValue;
public string GetStringValue() => _stringValue;
public (string, int) GetValue()
{
return (_stringValue, _intValue);
......@@ -61,5 +61,8 @@ namespace SkyApm.Common
if (HasIntValue) return _intValue.ToString();
return _stringValue;
}
public static implicit operator StringOrIntValue(string value) => new StringOrIntValue(value);
public static implicit operator StringOrIntValue(int value) => new StringOrIntValue(value);
}
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment