GithubHelp home page GithubHelp logo

genericenvironment's Introduction

Resume Profile views

Hello, Friend

๐Ÿฑโ€๐Ÿ’ป About me:

I'm a middle backend developer, work in company tiburon-research

๐Ÿ–ฅ Hard skills:



๐Ÿ“ˆ Statistics:


CodeWars

๐Ÿ“š Books:

I have read:


I read:

๐Ÿ“ซ How to reach me:

genericenvironment's People

Contributors

kurnakovv avatar vizerion07 avatar

Watchers

 avatar

genericenvironment's Issues

Nuget action

Instruction

  1. Create tag (1.0.1)
  2. My github code will deploy in to nuget with this tag (1.0.1)

GenericEnvironment.GetEnvironmentVariableOrDefault

Description

Get environment variable or default(TType) (generic Environment.GetEnvironmentVariable).

Signature

TType GetEnvironmentVariableOrDefault<TType>(string name)

Use cases

  • TType when environment variable was found.
  • default(TType) when name is null.
  • default(TType) when environment variable wasn't found.
  • default(TType) when cannot convert environment variable to TType.
  • default(TType) when a security error is detected.
  • default(TType) when an arithmetic, casting, or conversion operation in a checked context results in an overflow.

Type Parameters

TType - Type of environment variable value.

Parameters

name - Name of environment variable

Returns

Environment variable or default(TType).

Code examples

// Setup
Environment.SetEnvironmentVariable("IntEnvironmentVariable", "12345"); // or from launchSettings.json

// Code
int firstResult = GenericEnvironment.GetEnvironmentVariableOrDefault<int>("IntEnvironmentVariable");
bool secondResult =  GenericEnvironment.GetEnvironmentVariableOrDefault<int>("InvalidEnvironmentVariableName");

// Output
// firstResult - 12345
// secondResult - 0

GenericEnvironment.TryGetEnvironmentVariable

Description

Try get environment variable (generic Environment.GetEnvironmentVariable).

Signature

bool TryGetEnvironmentVariable<TType>(string name, out TType value)

Use cases

  • [true, value=TType] when environment variable was found.
  • [false, value=default(TType)] when name is null.
  • [false, value=default(TType)] when environment variable wasn't found.
  • [false, value=default(TType)] when cannot convert environment variable to TType.
  • [false, value=default(TType)] when a security error is detected.
  • [false, value=default(TType)] when an arithmetic, casting, or conversion operation in a checked context results in an overflow.

Type Parameters

TType - Type of environment variable value.

Parameters

name - Name of environment variable
value - Environment variable value

Returns

true if environment variable was gotten by name; otherwise, false.

Code examples

// Setup
Environment.SetEnvironmentVariable("IntEnvironmentVariable", "12345"); // or from launchSettings.json

// Code
bool firstResult = GenericEnvironment.TryGetEnvironmentVariable("IntEnvironmentVariable", out int firstValue);
bool secondResult =  GenericEnvironment.TryGetEnvironmentVariable("InvalidEnvironmentVariableName", out int secondValue);

// Output
// [firstResult, firstValue] = [true, 12345]
// [secondResult, secondValue] = [false, 0]

100% codecoverage

it's very strange why is not (because we have tests for all lines), but now we have 81%
Codecov

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.