This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ConfigurationService : IConfigurationService | |
{ | |
public ConfigurationService(IDataService dataService) | |
{ | |
_configurationSet = dataService.GetConfigurationSet(); | |
} | |
public ITriangleConfiguration TriangleConfiguration => _configurationSet.TriangleConfiguration; | |
public ISquareConfiguration SquareConfiguration => _configurationSet.SquareConfiguration; | |
public ICircleConfiguration CircleConfiguration => _configurationSet.CircleConfiguration; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum Day | |
{ | |
Sunday = 0, | |
Monday = 1, | |
Tuesday = 2, | |
Wednesday = 3, | |
Thursday = 4, | |
Friday = 5, | |
Saturday = 6 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private IEnumerable<(string key, int value)> GetEnum(Type enumType) | |
{ | |
return Enum.GetValues(enumType) | |
.Cast<int>() | |
.Select(e => (Enum.GetName(enumType, e), e)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int myNumber = 42; | |
// Adjust the first parameter to PadLeft to adjust the number of zeroes | |
string serialNumber = $"AXT{myNumber.ToString().PadLeft(5, '0')}"; | |
// serialNumber = AXT00042 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int myNumber = 42; | |
// Adjust the number after D to adjust the number of leading zeroes | |
string serial = $"AXT{myNumber:D5}"; | |
// serial = AXT00042 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A long running thing | |
doTheThing(a: number, b: number): Promise<boolean> { | |
return new Promise<boolean>((resolve, reject) => { | |
// Long running call (just pretend, ok?) | |
const c = a + b; | |
if (c > 0) { | |
resolve(true); | |
} | |
else { | |
resolve(false); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A long running thing | |
doTheThing(a: number, b: number): Promise<boolean> { | |
return new Promise<boolean>((resolve, reject) => { | |
// Long running call (just pretend, ok?) | |
const c = a + b; | |
if (c > 0) { | |
resolve(true); | |
} | |
else { | |
resolve(false); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create the test module | |
@NgModule({ | |
imports: [NgbModule.forRoot(), CommonModule], | |
exports: [YesNoModalComponent, MyCustomComponent], | |
declarations: [YesNoModalComponent, MyCustomComponent], | |
entryComponents: [YesNoModalComponent] | |
}) | |
class DialogTestModule { } | |
describe('MyTestComponent', () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum DayOfWeek | |
{ | |
Sunday = 0, | |
Monday = 1, | |
Tuesday = 2, | |
Wednesday = 3, | |
Thursday = 4, | |
Friday = 5, | |
Saturday = 6 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select [(ngModel)]="myValue" (ngModelChange)="toNumber()"> | |
<option *ngFor="let s of stuff" [value]="s.value">{{s.key}}</option> | |
</select> |
NewerOlder