提交 f67a8682 编写于 作者: 彭伟 提交者: Lemon

Add implicit convert (#187)

* Add general host

* Add sign

* Add implicit convert
上级 10b7aaba
/* /*
* Licensed to the SkyAPM under one or more * Licensed to the SkyAPM under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
...@@ -32,7 +32,7 @@ namespace SkyApm.Common ...@@ -32,7 +32,7 @@ namespace SkyApm.Common
public bool HasValue => HasIntValue || HasStringValue; public bool HasValue => HasIntValue || HasStringValue;
public bool HasIntValue => _intValue != 0; public bool HasIntValue => _intValue != 0;
public bool HasStringValue => _stringValue != null; public bool HasStringValue => _stringValue != null;
public StringOrIntValue(string value) public StringOrIntValue(string value)
...@@ -48,9 +48,9 @@ namespace SkyApm.Common ...@@ -48,9 +48,9 @@ namespace SkyApm.Common
} }
public int GetIntValue() => _intValue; public int GetIntValue() => _intValue;
public string GetStringValue() => _stringValue; public string GetStringValue() => _stringValue;
public (string, int) GetValue() public (string, int) GetValue()
{ {
return (_stringValue, _intValue); return (_stringValue, _intValue);
...@@ -61,5 +61,8 @@ namespace SkyApm.Common ...@@ -61,5 +61,8 @@ namespace SkyApm.Common
if (HasIntValue) return _intValue.ToString(); if (HasIntValue) return _intValue.ToString();
return _stringValue; 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册