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
| var text = txtserver.Text; | |
| if (!string.IsNullOrEmpty(text)) | |
| { | |
| IpAddress ipAddress; | |
| Uri url; | |
| if (IpAddress.TryParse(text, out ipAddress)) | |
| { | |
| // Valid IP |
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
| <?xml version="1.0" encoding="utf-8"?> | |
| <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
| <ItemGroup> | |
| <Content Include="App.config"> | |
| <SubType>Designer</SubType> | |
| </Content> | |
| <Content Include="App.Base.config"> | |
| <DependentUpon>App.config</DependentUpon> | |
| </Content> | |
| <Content Include="App.Debug.config"> |
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
| namespace Whoaverse.Models | |
| { | |
| using System; | |
| using System.Collections.Generic; | |
| public partial class Comment | |
| { | |
| public void Upvote(int userId) | |
| { | |
| } |
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
| interface EventStream | |
| { | |
| // Just a marker interface to let you know which classes are persisted. | |
| } | |
| class Site : EventStream | |
| { | |
| private readonly HashSet<string> _registeredUsers = new HashSet<string>(); | |
| public string Id { get; private set; } |
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
| // Domain | |
| interface IUsersRepository | |
| { | |
| IEnumerable<User> FindAll(int pageIndex, int pageSize); | |
| } | |
| class User | |
| { | |
| public int Id { get; private set; } |
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 static string Replace(string input, string regex) | |
| { | |
| var match = System.Text.RegularExpressions.Regex.Match(regex, @"^s(.)(?<Regex>.*?)(?:(?<!\\)\1)(?<Replace>.*?)(?:(?<!\\)\1)$"); | |
| var replaced = Regex.Replace(input, match.Groups["Regex"].Value, match.Groups["Replace"].Value); | |
| return replaced; | |
| } |
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
| var order = allCalls.Select((number, index) => new | |
| { | |
| Number = number, | |
| Duration = allDuration[index] | |
| }) | |
| .GroupBy(x => x.Number) | |
| .Select(x => new | |
| { | |
| Number = x.Key, | |
| Count = x.Count(), |
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
| class Queries | |
| { | |
| public static readonly string FindPrices = @" | |
| SELECT * | |
| FROM prices | |
| "; | |
| public static readonly string FindOneUserByUsername = @" | |
| SELECT * | |
| FROM users |
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
| interface IDependOn<T> | |
| { | |
| } | |
| class A | |
| { | |
| } | |
| class B | |
| { |
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
| interface IRepository<TEntity> | |
| { | |
| TEntity FindOne(Guid id); | |
| void Save(TEntity entity); | |
| } | |
| interface IUsersRepository : IRepository<User> | |
| { | |
| User FindOneByUsername(string username); | |
| } |