C#: 25-Class get/set

  • using getter/setters allows for logic to be used in the process
  • for gets, null checking can be performed for Singleton Design Patterns or different things can be returned based on state/value.
  • for sets, null checking & data validation can be performed on the incoming values

Object Instantiation with Property Sets

See Also: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/object-and-collection-initializers

When an object is instantiated, the values can be set in the same statement

Car myCar = new Car{Type="Honda",Price=15000};



C#: Selenium Selectors

Drupal8 Logout Link at footer ( XPath vs LinkText )

  • Had MUCH difficulty hooking into the logout link using XPATH for
  • JS window.scrollTo
  • By.LinkText(“Log out”) seems to be more accessible
  • using By.LinkText allowed Selenium to natively 'scroll to' on the 'Click()' method

Selenium basic selectors


el = driver.FindElement(By.XPath("//a[@href='/uc/user/logout']"));


el = driver.FindElement(By.Id("username"));


el = driver.FindElement(By.LinkText("Log out"));

JS scrollIntoView

  • when element found by XPath(//a), this didn't work
el = driver.FindElement(By.LinkText("Log out"));
((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].scrollIntoView(true);", el);



C#: Classes - Base & Sub

  • To create a sub class,
  • add ' : <classname>' to the class statement
  • add :' base()' to the constructor

Base Class WITHOUT Arguments

  • If Base Class accepts NO arguments, the subclass doesn't need to include the 'base class constructor'
    class BaseClass
        public BaseClass()
  • Constructor doesn't need an explicit reference to the base class
    class Base_SubClass : BaseClass
       public Base_SubClass()
  • This is also valid & probably preferred

    class Base_SubClass : BaseClass
       public Base_SubClass() : BaseClass() {}

Base Class WITH Arguments

  • If Base Class constructor TAKES arguments, the subclass constructor must include them explicitly


C#: VIsualStudio 2017 IISE Setup Considerations

Simple Answer

It looks like you are missing a binding information entry in applicationhost.config file.

  1. Open your applicationhost.config file. Possible locations are:

    • %userprofile%\Documents\IISExpress\config\applicationhost.config
    • $(solutionDir)\.vs\config\applicationhost.config (VS2015)
    • Failing that, inspect the output from iisexpress.exe to be sure.
  2. Locate your WebSite entry and add following binding with your machine name.

Win7: netsh Commands For Network Interface Settings via CLI

Dos Shell Script

@echo off
echo This script must be ran as ADMIN
set ipAddr=
set subMask=
set gwAddr=
set dns=dhcp
set dnsAddr=

echo %COMPUTERNAME% - %ipAddr% - %subMask% - %gwAddr% - %dnsAddr%
echo Setting inferace values now... CTRL-C to cancel
netsh interface ip set address name="Local Area Connection" static %ipAddr% %subMask% %gwAddr%
netsh interface ip set dns "Local Area Connection" source=dhcp

netsh Commands

Show if config

netsh interface ip show config

Set if to static

netsh interface ip set address name="Local Area Connection" static

Set DNS for DHCP

netsh interface ip set dns "Local Area Connection" source=dhcp

Set DNS to static value

Subscribe to