Tutorial by Examples: check

IsNotNull This is a very simple and popular method to use to check if an item is not null. It simply checks the object that is passed in to see if it is null. Assert.IsNotNull(database, type, "Name: {0}", item); IsNotNullOrEmpty This is the same as IsNotNull above, but works on strin...
ArgumentCondition This method checks to see if the argument specified is true. It also takes in the name of the argument that is logged if the condition fails. Assert.ArgumentCondition(pageIndex >= 0, "pageIndex", "Value must be greater than or equal to zero."); ArgumentN...
By default, all types in TypeScript allow null: function getId(x: Element) { return x.id; } getId(null); // TypeScript does not complain, but this is a runtime error. TypeScript 2.0 adds support for strict null checks. If you set --strictNullChecks when running tsc (or set this flag in you...
if ([object respondsToSelector:@selector(someOptionalMethodInProtocol:)]) { [object someOptionalMethodInProtocol:argument]; }
Returns a Boolean indicating if the class conform the protocol: [MyClass conformsToProtocol:@protocol(MyProtocol)];
fs.access() determines whether a path exists and what permissions a user has to the file or directory at that path. fs.access doesn't return a result rather, if it doesn't return an error, the path exists and the user has the desired permissions. The permission modes are available as a property on ...
This example starts Notepad, waits for it to be closed, then gets its exit code. #include <Windows.h> int main() { STARTUPINFOW si = { 0 }; si.cb = sizeof(si); PROCESS_INFORMATION pi = { 0 }; // Create the child process BOOL success = CreateProcessW( L"C:...
MySQL3.19 DROP TABLE IF EXISTS MyTable; PostgreSQL8.x DROP TABLE IF EXISTS MyTable; SQL Server2005 If Exists(Select * From Information_Schema.Tables Where Table_Schema = 'dbo' And Table_Name = 'MyTable') Drop Table dbo.MyTable SQLite3.0 DROP TABLE IF EXI...
public bool IsTypeNullable<T>() { return Nullable.GetUnderlyingType( typeof(T) )!=null; }
Overload resolution occurs after name lookup. This means that a better-matching function will not be selected by overload resolution if it loses name lookup: void f(int x); struct S { void f(double x); void g() { f(42); } // calls S::f because global f is not visible here, ...
$ react-native -v Example Output react-native-cli: 0.2.0 react-native: n/a - not inside a React Native project directory //Output from different folder react-native: react-native: 0.30.0 // Output from the react native project directory
string nullString = null; string emptyString = ""; string whitespaceString = " "; string tabString = "\t"; string newlineString = "\n"; string nonEmptyString = "abc123"; bool result; result = String.IsNullOrEmpty(nullString); ...
$this->helper('checkout/url')->getCheckoutUrl(); OR Mage::helper('checkout/url')->getCheckoutUrl();
let x = true match x with | true -> printfn "x is true" yields a warning C:\Program Files (x86)\Microsoft VS Code\Untitled-1(2,7): warning FS0025: Incomplete pattern matches on this expression. For example, the value 'false' may indicate a case not covered by the pattern(s). ...
This example show how you can check if a service already exists (i.e., is installed on the machine) or not. This code requires only the lowest privileges necessary, so each process can perform the check, no matter what level of security it is running at. #define UNICODE #define _UNICODE #include ...
Asynchronously var fs = require('fs'); fs.stat('path/to/file', function(err) { if (!err) { console.log('file or directory exists'); } else if (err.code === 'ENOENT') { console.log('file or directory does not exist'); } }); Synchronously here, we must wr...
You've made a stash and wish to checkout only some of the files in that stash. git checkout stash@{0} -- myfile.txt
Assuming we want to modify bit n of an integer primitive, i (byte, short, char, int, or long): (i & 1 << n) != 0 // checks bit 'n' i |= 1 << n; // sets bit 'n' to 1 i &= ~(1 << n); // sets bit 'n' to 0 i ^= 1 << n; // toggles the value of bit 'n' Us...
C# statements executes in either checked or unchecked context. In a checked context, arithmetic overflow raises an exception. In an unchecked context, arithmetic overflow is ignored and the result is truncated. short m = 32767; short n = 32767; int result1 = checked((short)(m + n)); //will ...
To get version 5394 use: svn co --revision r5394 https://svn.example.com/svn/MyRepo/MyProject/trunk Or the shorter version: svn co -r 5394 https://svn.example.com/svn/MyRepo/MyProject/trunk Or by using pegged revisions: svn co https://svn.example.com/svn/MyRepo/MyProject/trunk@5394 If al...

Page 3 of 12