Akka.Configuration.Config.GetInt C# (CSharp) Method

GetInt() public method

Retrieves an integer value from the specified path in the configuration.
public GetInt ( string path, int @default ) : int
path string The path that contains the value to retrieve.
@default int
return int
        public virtual int GetInt(string path, int @default = 0)
        {
            HoconValue value = GetNode(path);
            if (value == null)
                return @default;

            return value.GetInt();
        }

Usage Example

示例#1
0
        public UserWorker(ClusterNodeContext context, Config config)
        {
            _context = context;
            _channelType = (ChannelType)Enum.Parse(typeof(ChannelType), config.GetString("type", "Tcp"), true);
            _listenEndPoint = new IPEndPoint(IPAddress.Any, config.GetInt("port", 0));

            var connectAddress = config.GetString("connect-address");
            var connectPort = config.GetInt("connect-port", _listenEndPoint.Port);
            _connectEndPoint = new IPEndPoint(connectAddress != null ? IPAddress.Parse(connectAddress) : IPAddress.Loopback, connectPort);
        }
All Usage Examples Of Akka.Configuration.Config::GetInt