├── .gitattributes ├── .gitignore ├── AsyncronousProgramming ├── AsyncronousProgramming.sln ├── AsyncronousProgramming │ ├── App.config │ ├── AsyncronousProgramming.csproj │ ├── Program.cs │ └── Properties │ │ └── AssemblyInfo.cs └── ReadMe.md ├── CrazyButton ├── CrazyButton.sln ├── CrazyButton │ ├── App.config │ ├── CrazyButton.csproj │ ├── Form1.Designer.cs │ ├── Form1.cs │ ├── Form1.resx │ ├── Program.cs │ └── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings ├── README.md └── button.gif ├── DirectoryTree ├── DirectoryTree.sln ├── DirectoryTree │ ├── DirectionsTree.cs │ ├── DirectoryTree.csproj │ └── Properties │ │ └── AssemblyInfo.cs ├── README.md ├── Testing │ ├── App.config │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── Testing.csproj └── Tree.gif.gif ├── EventsAndDelegates ├── EventDemo │ ├── App.config │ ├── EventDemo.csproj │ ├── Program.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── EventsAndDelegates.sln ├── EventsAndDelegates │ ├── Agencies.cs │ ├── EventsAndDelegates.csproj │ ├── News.cs │ └── Properties │ │ └── AssemblyInfo.cs └── README.md ├── ExceptionHandling ├── ExceptionHandling.sln ├── ExceptionHandling │ ├── ExceptionHandling.csproj │ ├── HandlingInFiles.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── README.md └── Testing │ ├── App.config │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ └── Testing.csproj ├── GetMimeType ├── GetMimeType.sln └── GetMimeType │ ├── App.config │ ├── GetMimeType.csproj │ ├── Program.cs │ └── Properties │ └── AssemblyInfo.cs ├── HandMadeLINQ ├── HandMadeLINQ.sln ├── HandMadeLINQ │ ├── HandMadeLINQ.csproj │ ├── MyLINQ.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── ReadMe.md └── Testing │ ├── App.config │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ └── Testing.csproj ├── ImplementingIterators ├── ImplementingIterators.sln ├── ImplementingIterators1 │ ├── Derived.cs │ ├── ImplementingIterators1.csproj │ └── Properties │ │ └── AssemblyInfo.cs ├── README.md ├── Testing │ ├── App.config │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── Testing.csproj └── iterators.gif ├── IndexersDemo ├── IndexersDemo.sln ├── IndexersDemo │ ├── Indexers.cs │ ├── IndexersDemo.csproj │ └── Properties │ │ └── AssemblyInfo.cs ├── ReadMe.md └── Test │ ├── App.config │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ └── Test.csproj ├── MethodToInt32 ├── MethodToInt32.sln └── MethodToInt32 │ ├── App.config │ ├── MethodToInt32.csproj │ ├── Program.cs │ └── Properties │ └── AssemblyInfo.cs ├── MyDataBase ├── Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll ├── Microsoft.CodeDom.Providers.DotNetCompilerPlatform.xml ├── MyDataBase.sln ├── MyDataBase │ ├── Contact_MailingList.sql │ ├── Contacts.sql │ ├── MailList.sql │ ├── MyDataBase.jfm │ └── MyDataBase.sqlproj └── SendingMails │ ├── App_Start │ ├── BundleConfig.cs │ ├── FilterConfig.cs │ ├── IdentityConfig.cs │ ├── RouteConfig.cs │ ├── Startup.Auth.cs │ └── WebApiConfig.cs │ ├── ApplicationInsights.config │ ├── Areas │ └── HelpPage │ │ ├── ApiDescriptionExtensions.cs │ │ ├── App_Start │ │ └── HelpPageConfig.cs │ │ ├── Controllers │ │ └── HelpController.cs │ │ ├── HelpPage.css │ │ ├── HelpPageAreaRegistration.cs │ │ ├── HelpPageConfigurationExtensions.cs │ │ ├── ModelDescriptions │ │ ├── CollectionModelDescription.cs │ │ ├── ComplexTypeModelDescription.cs │ │ ├── DictionaryModelDescription.cs │ │ ├── EnumTypeModelDescription.cs │ │ ├── EnumValueDescription.cs │ │ ├── IModelDocumentationProvider.cs │ │ ├── KeyValuePairModelDescription.cs │ │ ├── ModelDescription.cs │ │ ├── ModelDescriptionGenerator.cs │ │ ├── ModelNameAttribute.cs │ │ ├── ModelNameHelper.cs │ │ ├── ParameterAnnotation.cs │ │ ├── ParameterDescription.cs │ │ └── SimpleTypeModelDescription.cs │ │ ├── Models │ │ └── HelpPageApiModel.cs │ │ ├── SampleGeneration │ │ ├── HelpPageSampleGenerator.cs │ │ ├── HelpPageSampleKey.cs │ │ ├── ImageSample.cs │ │ ├── InvalidSample.cs │ │ ├── ObjectGenerator.cs │ │ ├── SampleDirection.cs │ │ └── TextSample.cs │ │ ├── Views │ │ ├── Help │ │ │ ├── Api.cshtml │ │ │ ├── DisplayTemplates │ │ │ │ ├── ApiGroup.cshtml │ │ │ │ ├── CollectionModelDescription.cshtml │ │ │ │ ├── ComplexTypeModelDescription.cshtml │ │ │ │ ├── DictionaryModelDescription.cshtml │ │ │ │ ├── EnumTypeModelDescription.cshtml │ │ │ │ ├── HelpPageApiModel.cshtml │ │ │ │ ├── ImageSample.cshtml │ │ │ │ ├── InvalidSample.cshtml │ │ │ │ ├── KeyValuePairModelDescription.cshtml │ │ │ │ ├── ModelDescriptionLink.cshtml │ │ │ │ ├── Parameters.cshtml │ │ │ │ ├── Samples.cshtml │ │ │ │ ├── SimpleTypeModelDescription.cshtml │ │ │ │ └── TextSample.cshtml │ │ │ ├── Index.cshtml │ │ │ └── ResourceModel.cshtml │ │ ├── Shared │ │ │ └── _Layout.cshtml │ │ ├── Web.config │ │ └── _ViewStart.cshtml │ │ └── XmlDocumentationProvider.cs │ ├── Content │ ├── Site.css │ ├── bootstrap.css │ └── bootstrap.min.css │ ├── Controllers │ ├── AccountController.cs │ ├── HomeController.cs │ ├── MailController.cs │ ├── SendMailController.cs │ └── ValuesController.cs │ ├── Global.asax │ ├── Global.asax.cs │ ├── Models │ ├── AccountBindingModels.cs │ ├── AccountViewModels.cs │ └── IdentityModels.cs │ ├── Project_Readme.html │ ├── Properties │ └── AssemblyInfo.cs │ ├── Providers │ └── ApplicationOAuthProvider.cs │ ├── Results │ └── ChallengeResult.cs │ ├── Scripts │ ├── _references.js │ ├── bootstrap.js │ ├── bootstrap.min.js │ ├── jquery-1.10.2.intellisense.js │ ├── jquery-1.10.2.js │ ├── jquery-1.10.2.min.js │ ├── jquery-1.10.2.min.map │ ├── jquery.validate-vsdoc.js │ ├── jquery.validate.js │ ├── jquery.validate.min.js │ ├── jquery.validate.unobtrusive.js │ ├── jquery.validate.unobtrusive.min.js │ ├── modernizr-2.6.2.js │ ├── respond.js │ └── respond.min.js │ ├── SendingMails.csproj │ ├── Startup.cs │ ├── Views │ ├── Home │ │ └── Index.cshtml │ ├── Shared │ │ ├── Error.cshtml │ │ └── _Layout.cshtml │ ├── Web.config │ └── _ViewStart.cshtml │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Web.config │ ├── favicon.ico │ ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ └── glyphicons-halflings-regular.woff │ └── packages.config ├── ObjectToFile ├── ObjectToFile.sln └── ObjectToFile │ ├── CSVProvider.cs │ ├── ObjectToFile.csproj │ ├── Properties │ └── AssemblyInfo.cs │ └── ToFile.cs ├── README.md ├── ReadingFromExcel ├── ReadingFromExcel.sln ├── ReadingFromExcel │ ├── App.config │ ├── Contact.cs │ ├── EmailList.cs │ ├── Model1.Context.cs │ ├── Model1.Context.tt │ ├── Model1.Designer.cs │ ├── Model1.cs │ ├── Model1.edmx │ ├── Model1.edmx.diagram │ ├── Model1.tt │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── ReadingFromExcel.csproj │ ├── Template.cs │ └── packages.config └── SendingEmails │ ├── App.config │ ├── Crypting.cs │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── SendingEmails.csproj │ └── packages.config ├── ReflectionDemo ├── ReadMe.md ├── ReflectionDemo.sln └── ReflectionDemo │ ├── App.config │ ├── GetInformationAboutObject.cs │ ├── Person.cs │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ └── ReflectionDemo.csproj ├── RegularEx ├── RegularEx.sln └── RegularEx │ ├── App.config │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ └── RegularEx.csproj ├── SimpleAPI ├── SimpleAPI.sln └── SimpleAPI │ ├── App_Start │ ├── BundleConfig.cs │ ├── FilterConfig.cs │ ├── IdentityConfig.cs │ ├── RouteConfig.cs │ ├── Startup.Auth.cs │ └── WebApiConfig.cs │ ├── ApplicationInsights.config │ ├── Areas │ └── HelpPage │ │ ├── ApiDescriptionExtensions.cs │ │ ├── App_Start │ │ └── HelpPageConfig.cs │ │ ├── Controllers │ │ └── HelpController.cs │ │ ├── HelpPage.css │ │ ├── HelpPageAreaRegistration.cs │ │ ├── HelpPageConfigurationExtensions.cs │ │ ├── ModelDescriptions │ │ ├── CollectionModelDescription.cs │ │ ├── ComplexTypeModelDescription.cs │ │ ├── DictionaryModelDescription.cs │ │ ├── EnumTypeModelDescription.cs │ │ ├── EnumValueDescription.cs │ │ ├── IModelDocumentationProvider.cs │ │ ├── KeyValuePairModelDescription.cs │ │ ├── ModelDescription.cs │ │ ├── ModelDescriptionGenerator.cs │ │ ├── ModelNameAttribute.cs │ │ ├── ModelNameHelper.cs │ │ ├── ParameterAnnotation.cs │ │ ├── ParameterDescription.cs │ │ └── SimpleTypeModelDescription.cs │ │ ├── Models │ │ └── HelpPageApiModel.cs │ │ ├── SampleGeneration │ │ ├── HelpPageSampleGenerator.cs │ │ ├── HelpPageSampleKey.cs │ │ ├── ImageSample.cs │ │ ├── InvalidSample.cs │ │ ├── ObjectGenerator.cs │ │ ├── SampleDirection.cs │ │ └── TextSample.cs │ │ ├── Views │ │ ├── Help │ │ │ ├── Api.cshtml │ │ │ ├── DisplayTemplates │ │ │ │ ├── ApiGroup.cshtml │ │ │ │ ├── CollectionModelDescription.cshtml │ │ │ │ ├── ComplexTypeModelDescription.cshtml │ │ │ │ ├── DictionaryModelDescription.cshtml │ │ │ │ ├── EnumTypeModelDescription.cshtml │ │ │ │ ├── HelpPageApiModel.cshtml │ │ │ │ ├── ImageSample.cshtml │ │ │ │ ├── InvalidSample.cshtml │ │ │ │ ├── KeyValuePairModelDescription.cshtml │ │ │ │ ├── ModelDescriptionLink.cshtml │ │ │ │ ├── Parameters.cshtml │ │ │ │ ├── Samples.cshtml │ │ │ │ ├── SimpleTypeModelDescription.cshtml │ │ │ │ └── TextSample.cshtml │ │ │ ├── Index.cshtml │ │ │ └── ResourceModel.cshtml │ │ ├── Shared │ │ │ └── _Layout.cshtml │ │ ├── Web.config │ │ └── _ViewStart.cshtml │ │ └── XmlDocumentationProvider.cs │ ├── Content │ ├── Site.css │ ├── bootstrap.css │ └── bootstrap.min.css │ ├── Controllers │ └── HomeController.cs │ ├── Global.asax │ ├── Global.asax.cs │ ├── Models │ ├── AccountBindingModels.cs │ ├── AccountViewModels.cs │ └── IdentityModels.cs │ ├── Project_Readme.html │ ├── Properties │ └── AssemblyInfo.cs │ ├── Providers │ └── ApplicationOAuthProvider.cs │ ├── Results │ └── ChallengeResult.cs │ ├── Scripts │ ├── _references.js │ ├── bootstrap.js │ ├── bootstrap.min.js │ ├── jquery-1.10.2.intellisense.js │ ├── jquery-1.10.2.js │ ├── jquery-1.10.2.min.js │ ├── jquery-1.10.2.min.map │ ├── jquery.validate-vsdoc.js │ ├── jquery.validate.js │ ├── jquery.validate.min.js │ ├── jquery.validate.unobtrusive.js │ ├── jquery.validate.unobtrusive.min.js │ ├── modernizr-2.6.2.js │ ├── respond.js │ └── respond.min.js │ ├── SimpleAPI.csproj │ ├── Startup.cs │ ├── Views │ ├── Home │ │ └── Index.cshtml │ ├── Shared │ │ ├── Error.cshtml │ │ └── _Layout.cshtml │ ├── Web.config │ └── _ViewStart.cshtml │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Web.config │ ├── favicon.ico │ ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ └── glyphicons-halflings-regular.woff │ └── packages.config ├── StaticMembers ├── StaticMembers.sln └── StaticMembers │ ├── App.config │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ └── StaticMembers.csproj ├── TestingDependencyInjection ├── BLL │ ├── BLL.csproj │ ├── DependencyFactory.cs │ ├── IManager.cs │ ├── Manager.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── packages.config ├── Demo │ ├── App.config │ ├── Demo.csproj │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── packages.config ├── Repo │ ├── DataManager.cs │ ├── IDataManager.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── Repo.csproj ├── TestingDependencyInjection.sln └── TestingDependencyInjection │ ├── App.xaml │ ├── App.xaml.cs │ ├── Assets │ ├── LockScreenLogo.scale-200.png │ ├── SplashScreen.scale-200.png │ ├── Square150x150Logo.scale-200.png │ ├── Square44x44Logo.scale-200.png │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ ├── StoreLogo.png │ └── Wide310x150Logo.scale-200.png │ ├── MainPage.xaml │ ├── MainPage.xaml.cs │ ├── Package.appxmanifest │ ├── Properties │ ├── AssemblyInfo.cs │ └── Default.rd.xml │ ├── TestingDependencyInjection.csproj │ └── project.json ├── Vectors_OverloadingOperators+- ├── Demo │ ├── App.config │ ├── Demo.csproj │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── Vector.cs ├── OverloadingDemo │ ├── Overloading.cs │ ├── OverloadingDemo.csproj │ └── Properties │ │ └── AssemblyInfo.cs ├── README.md ├── VectorsOverloadingOperators.sln ├── addition.gif └── subtraction.gif └── bruce.gif /AsyncronousProgramming/AsyncronousProgramming.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AsyncronousProgramming", "AsyncronousProgramming\AsyncronousProgramming.csproj", "{B70303FD-A6A9-4DC8-883A-953ADEE18FDE}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {B70303FD-A6A9-4DC8-883A-953ADEE18FDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {B70303FD-A6A9-4DC8-883A-953ADEE18FDE}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {B70303FD-A6A9-4DC8-883A-953ADEE18FDE}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {B70303FD-A6A9-4DC8-883A-953ADEE18FDE}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /AsyncronousProgramming/AsyncronousProgramming/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /AsyncronousProgramming/AsyncronousProgramming/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("AsyncronousProgramming")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("AsyncronousProgramming")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("b70303fd-a6a9-4dc8-883a-953adee18fde")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /AsyncronousProgramming/ReadMe.md: -------------------------------------------------------------------------------- 1 | ##Asyncronous programming 2 | -------------------------------------------------------------------------------- /CrazyButton/CrazyButton.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CrazyButton", "CrazyButton\CrazyButton.csproj", "{B1A302B6-1B0F-4ADB-83AB-52AD3E0E93E1}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {B1A302B6-1B0F-4ADB-83AB-52AD3E0E93E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {B1A302B6-1B0F-4ADB-83AB-52AD3E0E93E1}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {B1A302B6-1B0F-4ADB-83AB-52AD3E0E93E1}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {B1A302B6-1B0F-4ADB-83AB-52AD3E0E93E1}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /CrazyButton/CrazyButton/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /CrazyButton/CrazyButton/Form1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace CrazyButton 12 | { 13 | public partial class Form1 : Form 14 | { 15 | public Form1() 16 | { 17 | InitializeComponent(); 18 | label1.Location = new Point((ClientSize.Width)/2- label1.Text.Length, 20); 19 | } 20 | 21 | private void button1_MouseMove(object sender, MouseEventArgs e) 22 | { 23 | Point coordinates = Cursor.Position; 24 | Random r = new Random(); 25 | int bx, by; 26 | 27 | bx = r.Next(button1.Width, ClientSize.Width-button1.Width); 28 | by = r.Next(button1.Height,ClientSize.Height-button1.Height); 29 | button1.Location = new Point(bx, by); 30 | label1.Location = new Point((ClientSize.Width - label1.Text.Length) / 2, 20); 31 | 32 | } 33 | 34 | private void button1_Click(object sender, EventArgs e) 35 | { 36 | 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /CrazyButton/CrazyButton/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace CrazyButton 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new Form1()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /CrazyButton/CrazyButton/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CrazyButton")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CrazyButton")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("b1a302b6-1b0f-4adb-83ab-52ad3e0e93e1")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /CrazyButton/CrazyButton/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CrazyButton.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /CrazyButton/CrazyButton/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CrazyButton/README.md: -------------------------------------------------------------------------------- 1 | 2 | ##Crazy Button 3 | ![](https://github.com/merisahakyan/UsefulExamples/blob/master/CrazyButton/button.gif) 4 |
5 | ```cs 6 | private void button1_MouseMove(object sender, MouseEventArgs e) 7 | { 8 | Point coordinates = Cursor.Position; 9 | Random r = new Random(); 10 | int bx, by; 11 | bx = r.Next(button1.Width, ClientSize.Width-button1.Width; 12 | by = r.Next(button1.Height,ClientSize.Height-button1.Height); 13 | button1.Location = new Point(bx, by); 14 | label1.Location = new Point((ClientSize.Width - label1.Text.Length) / 2, 20); 15 | } 16 | ``` 17 | -------------------------------------------------------------------------------- /CrazyButton/button.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/merisahakyan/UsefulExamples/507a2d5da4d401328578d5884ee74dee64ed5392/CrazyButton/button.gif -------------------------------------------------------------------------------- /DirectoryTree/DirectoryTree.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DirectoryTree", "DirectoryTree\DirectoryTree.csproj", "{CD953C02-145B-42D9-99CF-DB7CA84C78B8}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testing", "Testing\Testing.csproj", "{48AF3DA7-6DA1-4870-B153-B99F7CD305BA}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {CD953C02-145B-42D9-99CF-DB7CA84C78B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {CD953C02-145B-42D9-99CF-DB7CA84C78B8}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {CD953C02-145B-42D9-99CF-DB7CA84C78B8}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {CD953C02-145B-42D9-99CF-DB7CA84C78B8}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {48AF3DA7-6DA1-4870-B153-B99F7CD305BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {48AF3DA7-6DA1-4870-B153-B99F7CD305BA}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {48AF3DA7-6DA1-4870-B153-B99F7CD305BA}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {48AF3DA7-6DA1-4870-B153-B99F7CD305BA}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /DirectoryTree/DirectoryTree/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("DirectoryTree")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("DirectoryTree")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("cd953c02-145b-42d9-99cf-db7ca84c78b8")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /DirectoryTree/README.md: -------------------------------------------------------------------------------- 1 | ### DirectoryTree Class Library 2 | This class library allows to get any folders structure on your computer.For using add reference on your application like this:
3 | ```cs 4 | using DirectoryTree; 5 | namespace Testing 6 | { 7 | class Program 8 | { 9 | static void Main(string[] args) 10 | { 11 | string str=Console.ReadLine(); 12 | DirectionsTree.GetTree(@str); 13 | DirectionsTree.Print(); 14 | } 15 | } 16 | } 17 | ``` 18 | ## This is my D:\ folders structure 19 | ![](https://github.com/marysahakyan/UsefulExamples/blob/master/DirectoryTree/Tree.gif.gif) 20 | -------------------------------------------------------------------------------- /DirectoryTree/Testing/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /DirectoryTree/Testing/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using DirectoryTree; 3 | 4 | namespace Testing 5 | { 6 | class Program 7 | { 8 | static void Main(string[] args) 9 | { 10 | string str = Console.ReadLine(); 11 | DirectionsTree.GetTree(@str); 12 | DirectionsTree.Print(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /DirectoryTree/Testing/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Testing")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Testing")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("48af3da7-6da1-4870-b153-b99f7cd305ba")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /DirectoryTree/Tree.gif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/merisahakyan/UsefulExamples/507a2d5da4d401328578d5884ee74dee64ed5392/DirectoryTree/Tree.gif.gif -------------------------------------------------------------------------------- /EventsAndDelegates/EventDemo/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /EventsAndDelegates/EventDemo/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using EventsAndDelegates; 7 | 8 | namespace EventDemo 9 | { 10 | class Program 11 | { 12 | static void Main(string[] args) 13 | { 14 | Agencies[] agencies = { new Agencies("BBC"), new Agencies("CNN"), new Agencies("RTR") }; 15 | foreach (var item in agencies) 16 | { 17 | item.MyNews += ShowNews; 18 | } 19 | 20 | 21 | agencies[0].BroadcastNews(); 22 | agencies[1].BroadcastNews1(); 23 | agencies[2].BroadcastNews2(); 24 | 25 | } 26 | private static void ShowNews(object sender,EventArgs e) 27 | { 28 | var agency = (Agencies)sender ; 29 | if(agency!=null) 30 | Console.WriteLine($"{agency.agencyname}: {e.ToString()}"); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /EventsAndDelegates/EventDemo/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("EventDemo")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("EventDemo")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("9ae13db0-aa9b-4d39-9d28-ff477b5756a4")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /EventsAndDelegates/EventsAndDelegates.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventsAndDelegates", "EventsAndDelegates\EventsAndDelegates.csproj", "{1FD0D7E0-DEBB-41A4-8C89-44571E407EC4}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventDemo", "EventDemo\EventDemo.csproj", "{9AE13DB0-AA9B-4D39-9D28-FF477B5756A4}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {1FD0D7E0-DEBB-41A4-8C89-44571E407EC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {1FD0D7E0-DEBB-41A4-8C89-44571E407EC4}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {1FD0D7E0-DEBB-41A4-8C89-44571E407EC4}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {1FD0D7E0-DEBB-41A4-8C89-44571E407EC4}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {9AE13DB0-AA9B-4D39-9D28-FF477B5756A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {9AE13DB0-AA9B-4D39-9D28-FF477B5756A4}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {9AE13DB0-AA9B-4D39-9D28-FF477B5756A4}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {9AE13DB0-AA9B-4D39-9D28-FF477B5756A4}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /EventsAndDelegates/EventsAndDelegates/Agencies.cs: -------------------------------------------------------------------------------- 1 |  2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace EventsAndDelegates 9 | { 10 | public class Agencies 11 | { public string agencyname { get; set; } 12 | public Agencies(string name) 13 | { 14 | agencyname = name; 15 | } 16 | public event EventHandler MyNews; 17 | public void BroadcastNews() 18 | { 19 | var args = new News 20 | { 21 | Title = "Donald Trump's wife...", 22 | Date = DateTime.Now 23 | }; 24 | MyNews?.Invoke(this, args); 25 | } 26 | public void BroadcastNews1() 27 | { 28 | var args = new News 29 | { 30 | Title = "Barac Obama...", 31 | Date = DateTime.Today 32 | }; 33 | MyNews?.Invoke(this, args); 34 | } 35 | public void BroadcastNews2() 36 | { 37 | var args = new News 38 | { 39 | Title = "Vladiir Putin...", 40 | Date = DateTime.Now 41 | }; 42 | MyNews?.Invoke(this, args); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /EventsAndDelegates/EventsAndDelegates/News.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace EventsAndDelegates 8 | { 9 | public class News: EventArgs 10 | { public string Title { get; set; } 11 | public DateTime Date { get; set; } 12 | public override string ToString() 13 | { 14 | return $"{Title}: {Date}"; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /EventsAndDelegates/EventsAndDelegates/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("EventsAndDelegates")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("EventsAndDelegates")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("1fd0d7e0-debb-41a4-8c89-44571e407ec4")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /EventsAndDelegates/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /ExceptionHandling/ExceptionHandling.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExceptionHandling", "ExceptionHandling\ExceptionHandling.csproj", "{7E7D87ED-B908-495C-8B77-639CFB0AC04D}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testing", "Testing\Testing.csproj", "{3FA93EDF-DC67-4E12-A4F2-6B4454B8C287}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {7E7D87ED-B908-495C-8B77-639CFB0AC04D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {7E7D87ED-B908-495C-8B77-639CFB0AC04D}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {7E7D87ED-B908-495C-8B77-639CFB0AC04D}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {7E7D87ED-B908-495C-8B77-639CFB0AC04D}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {3FA93EDF-DC67-4E12-A4F2-6B4454B8C287}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {3FA93EDF-DC67-4E12-A4F2-6B4454B8C287}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {3FA93EDF-DC67-4E12-A4F2-6B4454B8C287}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {3FA93EDF-DC67-4E12-A4F2-6B4454B8C287}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /ExceptionHandling/ExceptionHandling/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ExceptionHandling")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ExceptionHandling")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("7e7d87ed-b908-495c-8b77-639cfb0ac04d")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ExceptionHandling/Testing/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ExceptionHandling/Testing/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using ExceptionHandling; 7 | 8 | namespace Testing 9 | { 10 | class Program 11 | { 12 | static void Main(string[] args) 13 | { 14 | string path1 = @"C:\New Folder\text.txt"; 15 | string path2 = @"C:\New Folder\cdhgcydgyhgdhghhpppppppppppppppppppppppppppppppppppppppppppphhhhhhhhhhhhhhhhhhhhhllllppppppppppppppppppppppppppppppppplllllllllllllllllllllllllllhhhhhhhhkkklllllllllllllllllkkkkkkkkkkkkkkkkkkkkhhhggggyyyyyyyyyyyyyyyyyyyytttttttttttttttttttttttttt.txt"; 16 | HandlingInFiles.TxtReader(path1); 17 | HandlingInFiles.TxtReader(path2); 18 | for (int i = 0; i < 5; i++) 19 | HandlingInFiles.TxtWriter(path1); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ExceptionHandling/Testing/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Testing")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Testing")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("3fa93edf-dc67-4e12-a4f2-6b4454b8c287")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /GetMimeType/GetMimeType.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GetMimeType", "GetMimeType\GetMimeType.csproj", "{711A01BD-40AF-48C0-A188-62E5E8667761}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {711A01BD-40AF-48C0-A188-62E5E8667761}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {711A01BD-40AF-48C0-A188-62E5E8667761}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {711A01BD-40AF-48C0-A188-62E5E8667761}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {711A01BD-40AF-48C0-A188-62E5E8667761}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /GetMimeType/GetMimeType/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /GetMimeType/GetMimeType/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("GetMimeType")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("GetMimeType")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("711a01bd-40af-48c0-a188-62e5e8667761")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /HandMadeLINQ/HandMadeLINQ.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HandMadeLINQ", "HandMadeLINQ\HandMadeLINQ.csproj", "{C9200022-3C67-4E71-8FD2-CF2B0D555B00}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testing", "Testing\Testing.csproj", "{56029805-1663-4167-BD56-A6114C6841ED}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {C9200022-3C67-4E71-8FD2-CF2B0D555B00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {C9200022-3C67-4E71-8FD2-CF2B0D555B00}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {C9200022-3C67-4E71-8FD2-CF2B0D555B00}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {C9200022-3C67-4E71-8FD2-CF2B0D555B00}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {56029805-1663-4167-BD56-A6114C6841ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {56029805-1663-4167-BD56-A6114C6841ED}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {56029805-1663-4167-BD56-A6114C6841ED}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {56029805-1663-4167-BD56-A6114C6841ED}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /HandMadeLINQ/HandMadeLINQ/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("HandMadeLINQ")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("HandMadeLINQ")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("c9200022-3c67-4e71-8fd2-cf2b0d555b00")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /HandMadeLINQ/ReadMe.md: -------------------------------------------------------------------------------- 1 | ## Createating class library like LINQ 2 | Class library **HandMadeLINQ** contains class *MyLINQ** which consists of many extension methods just like to LINQ methods.
3 | For example extension method **.MySelect(Func selector)** projects each element of a sequence
4 | into a new form like LINQ method **.Select(Func selector)**
5 | Return Value Type: System.Collections.Generic.IEnumerable 6 | ```cs 7 | public static IEnumerable MySelect(this IEnumerable collection, Func createnew) 8 | { 9 | foreach (var item in collection) 10 | { 11 | yield return createnew(item); 12 | } 13 | } 14 | ``` 15 | Another exaple is extension method **.MyReverse()** which inverts the order of the elements in a sequence like
16 | LINQ method **.Reverse()**.
17 | Return Value Type: System.Collections.Generic.IEnumerable 18 | ```cs 19 | public static IEnumerable MyReverse(this IEnumerable collection) 20 | { 21 | var collection1 = collection.ToList(); 22 | List result = new List(); 23 | for(int i=collection1.Count()-1;i>=0;i--) 24 | { 25 | result.Add(collection1[i]); 26 | } 27 | return result.AsEnumerable(); 28 | } 29 | ``` 30 | ###Look other methods here [class MyLINQ](https://github.com/merisahakyan/UsefulExamples/blob/master/HandMadeLINQ/HandMadeLINQ/MyLINQ.cs) 31 | -------------------------------------------------------------------------------- /HandMadeLINQ/Testing/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /HandMadeLINQ/Testing/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Testing")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Testing")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("56029805-1663-4167-bd56-a6114c6841ed")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ImplementingIterators/ImplementingIterators.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testing", "Testing\Testing.csproj", "{922DF546-6B9F-4FE7-9668-E030DAAC0964}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImplementingIterators1", "ImplementingIterators1\ImplementingIterators1.csproj", "{681EDD4E-8592-4295-A5E6-0AB576FADEFC}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {922DF546-6B9F-4FE7-9668-E030DAAC0964}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {922DF546-6B9F-4FE7-9668-E030DAAC0964}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {922DF546-6B9F-4FE7-9668-E030DAAC0964}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {922DF546-6B9F-4FE7-9668-E030DAAC0964}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {681EDD4E-8592-4295-A5E6-0AB576FADEFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {681EDD4E-8592-4295-A5E6-0AB576FADEFC}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {681EDD4E-8592-4295-A5E6-0AB576FADEFC}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {681EDD4E-8592-4295-A5E6-0AB576FADEFC}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /ImplementingIterators/ImplementingIterators1/Derived.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace ImplementingIterators1 9 | { 10 | public class Derived : IEnumerable, IEnumerator 11 | 12 | { 13 | List list = new List(); 14 | int index; 15 | public Derived(List list) 16 | { 17 | this.list = list; 18 | index = -1; 19 | } 20 | public object Current 21 | { 22 | get 23 | { 24 | return this.list[index]; 25 | } 26 | } 27 | 28 | public IEnumerator GetEnumerator() 29 | { 30 | return list.GetEnumerator(); 31 | } 32 | 33 | public bool MoveNext() 34 | { 35 | if (index + 1 < list.Count) 36 | { 37 | index++; 38 | return true; 39 | } 40 | else 41 | return false; 42 | } 43 | 44 | public void Reset() 45 | { 46 | index = -1; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /ImplementingIterators/ImplementingIterators1/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ImplementingIterators1")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ImplementingIterators1")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("681edd4e-8592-4295-a5e6-0ab576fadefc")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ImplementingIterators/Testing/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ImplementingIterators/Testing/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using ImplementingIterators1; 7 | using System.Collections; 8 | 9 | namespace Testing 10 | { 11 | class Program 12 | { 13 | static void Main(string[] args) 14 | { 15 | List ints = new List(10); 16 | ints.Add(1); 17 | ints.Add(2); 18 | ints.Add(3); 19 | ints.Add(4); 20 | ints.Add(5); 21 | Derived dint = new Derived(ints); 22 | for (int i = 0; i < ints.Count; i++) 23 | if (dint.MoveNext()) 24 | Console.WriteLine(dint.Current); 25 | else 26 | dint.Reset(); 27 | dint.Reset(); 28 | Console.WriteLine("-------------"); 29 | for (int i = 0; i < ints.Count; i++) 30 | if (dint.MoveNext()) 31 | Console.WriteLine(dint.Current); 32 | else 33 | dint.Reset(); 34 | Console.WriteLine("Iterates-------------"); 35 | var en = GetIntegers(); 36 | 37 | foreach (var item in en) 38 | { 39 | Console.WriteLine(item); 40 | } 41 | } 42 | public static IEnumerable GetIntegers() 43 | { 44 | yield return 1; 45 | yield return 2; 46 | yield return 3; 47 | yield return 4; 48 | yield return 5; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /ImplementingIterators/Testing/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Testing")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Testing")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("922df546-6b9f-4fe7-9668-e030daac0964")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /ImplementingIterators/iterators.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/merisahakyan/UsefulExamples/507a2d5da4d401328578d5884ee74dee64ed5392/ImplementingIterators/iterators.gif -------------------------------------------------------------------------------- /IndexersDemo/IndexersDemo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IndexersDemo", "IndexersDemo\IndexersDemo.csproj", "{7025B6BE-FAF1-4AB6-8240-64BBF7001C99}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{CEDA8F60-AAB4-43A1-9A9D-417DF64B79ED}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {7025B6BE-FAF1-4AB6-8240-64BBF7001C99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {7025B6BE-FAF1-4AB6-8240-64BBF7001C99}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {7025B6BE-FAF1-4AB6-8240-64BBF7001C99}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {7025B6BE-FAF1-4AB6-8240-64BBF7001C99}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {CEDA8F60-AAB4-43A1-9A9D-417DF64B79ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {CEDA8F60-AAB4-43A1-9A9D-417DF64B79ED}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {CEDA8F60-AAB4-43A1-9A9D-417DF64B79ED}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {CEDA8F60-AAB4-43A1-9A9D-417DF64B79ED}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /IndexersDemo/IndexersDemo/Indexers.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Collections.Generic; 7 | 8 | namespace IndexersDemo 9 | { 10 | public class Indexers 11 | { 12 | Dictionary dic = new Dictionary(); 13 | public Indexers(Dictionary dic) 14 | { 15 | this.dic = dic; 16 | } 17 | public string this[int index] 18 | { 19 | get 20 | { 21 | if (dic.Keys.Contains(index)) 22 | return dic[index]; 23 | else 24 | throw new KeyNotFoundException("Key not found"); 25 | } 26 | } 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /IndexersDemo/IndexersDemo/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("IndexersDemo")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("IndexersDemo")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("7025b6be-faf1-4ab6-8240-64bbf7001c99")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /IndexersDemo/ReadMe.md: -------------------------------------------------------------------------------- 1 | ##Indexers 2 | Here we have class **Indexers** which contains ``` Dictionary``` **dic** private field.
3 | If we want to have a readonly dictionary, indexers can help us in this situation.
4 | Lets see how we can declare indexer insight the class. 5 | ```cs 6 | public string this[int index] 7 | { 8 | get 9 | { 10 | if (dic.Keys.Contains(index)) 11 | return dic[index]; 12 | else 13 | throw new KeyNotFoundException("Key not found"); 14 | } 15 | } 16 | ``` 17 | Our indexer has only **getter** method (readonly), but it may also have method **setter**.
18 | In the Main method we can call constructor of class **Indexers** 19 | ```cs 20 | Indexers obj = new Indexers(dictionary); 21 | ``` 22 | and then print all values with given keys. 23 | ```cs 24 | for (int i = 0; i < 10; i++) 25 | { 26 | Console.WriteLine(obj[i]); 27 | } 28 | ``` 29 | This code brings to **KeyNotFoundException**,because our **dictionary** contains keys only with numbers 0,1,2,3,4,5,6,7,8,9.
30 | Commented code is wrong,because our indexer has only **getter** method,we can't assign any value. 31 | 32 | ```cs 33 | Console.WriteLine(obj[10]); 34 | //obj[0] = "not zero"; 35 | ``` 36 | -------------------------------------------------------------------------------- /IndexersDemo/Test/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /IndexersDemo/Test/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using IndexersDemo; 7 | 8 | namespace Test 9 | { 10 | class Program 11 | { 12 | static void Main(string[] args) 13 | { 14 | Dictionary dictionary = new Dictionary(); 15 | dictionary.Add(1, "one"); 16 | dictionary.Add(2, "two"); 17 | dictionary.Add(3, "three"); 18 | dictionary.Add(4, "four"); 19 | dictionary.Add(5, "five"); 20 | dictionary.Add(6, "six"); 21 | dictionary.Add(7, "seven"); 22 | dictionary.Add(8, "eight"); 23 | dictionary.Add(9, "nine"); 24 | dictionary.Add(0, "zero"); 25 | Indexers obj = new Indexers(dictionary); 26 | 27 | for (int i = 0; i < 10; i++) 28 | { 29 | Console.WriteLine(obj[i]); 30 | } 31 | 32 | try 33 | { 34 | Console.WriteLine(obj[10]); 35 | } 36 | catch(KeyNotFoundException ex) 37 | { 38 | Console.WriteLine(ex.Message); 39 | } 40 | //This is uncorrect code,because our indexer is readonly, it does'n consist set accesor 41 | //obj[0] = "not zero"; 42 | 43 | 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /IndexersDemo/Test/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Test")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Test")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("ceda8f60-aab4-43a1-9a9d-417df64b79ed")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /MethodToInt32/MethodToInt32.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MethodToInt32", "MethodToInt32\MethodToInt32.csproj", "{898BD6EB-761B-492E-BBC6-2D43669AB828}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {898BD6EB-761B-492E-BBC6-2D43669AB828}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {898BD6EB-761B-492E-BBC6-2D43669AB828}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {898BD6EB-761B-492E-BBC6-2D43669AB828}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {898BD6EB-761B-492E-BBC6-2D43669AB828}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /MethodToInt32/MethodToInt32/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /MethodToInt32/MethodToInt32/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MethodToInt32 8 | { 9 | class Program 10 | { 11 | public static int ToInt32(byte a, byte b, byte c, byte d) 12 | { 13 | string str = a.ToString() + b.ToString() + c.ToString() + d.ToString(); 14 | return int.Parse(str); 15 | 16 | } 17 | static void Main(string[] args) 18 | { 19 | Console.WriteLine(ToInt32(2, 3, 5, 4)); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /MethodToInt32/MethodToInt32/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MethodToInt32")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MethodToInt32")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("898bd6eb-761b-492e-bbc6-2d43669ab828")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /MyDataBase/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/merisahakyan/UsefulExamples/507a2d5da4d401328578d5884ee74dee64ed5392/MyDataBase/Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll -------------------------------------------------------------------------------- /MyDataBase/MyDataBase/Contact_MailingList.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [dbo].[Contact_MailingList] 2 | ( 3 | [ContactId] int not null foreign key references Contacts (ContactId), 4 | [ListId] int not null foreign key references MailList (ListId) 5 | ) 6 | -------------------------------------------------------------------------------- /MyDataBase/MyDataBase/Contacts.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [dbo].[Contacts] 2 | ( 3 | [ContactId] INT NOT NULL PRIMARY KEY, 4 | [Name] varchar(50) not null, 5 | [Company] varchar(50) not null, 6 | [Position] varchar(50) not null, 7 | [Country] varchar(50) not null, 8 | [email] varchar(50) not null, 9 | [PublicID] uniqueidentifier not null 10 | ) 11 | -------------------------------------------------------------------------------- /MyDataBase/MyDataBase/MailList.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [dbo].[MailList] 2 | ( 3 | [ListId] INT NOT NULL PRIMARY KEY, 4 | [ListName] varchar(50) not null 5 | ) 6 | -------------------------------------------------------------------------------- /MyDataBase/MyDataBase/MyDataBase.jfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/merisahakyan/UsefulExamples/507a2d5da4d401328578d5884ee74dee64ed5392/MyDataBase/MyDataBase/MyDataBase.jfm -------------------------------------------------------------------------------- /MyDataBase/SendingMails/App_Start/BundleConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Optimization; 3 | 4 | namespace SendingMails 5 | { 6 | public class BundleConfig 7 | { 8 | // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 9 | public static void RegisterBundles(BundleCollection bundles) 10 | { 11 | bundles.Add(new ScriptBundle("~/bundles/jquery").Include( 12 | "~/Scripts/jquery-{version}.js")); 13 | 14 | // Use the development version of Modernizr to develop with and learn from. Then, when you're 15 | // ready for production, use the build tool at http://modernizr.com to pick only the tests you need. 16 | bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( 17 | "~/Scripts/modernizr-*")); 18 | 19 | bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include( 20 | "~/Scripts/bootstrap.js", 21 | "~/Scripts/respond.js")); 22 | 23 | bundles.Add(new StyleBundle("~/Content/css").Include( 24 | "~/Content/bootstrap.css", 25 | "~/Content/site.css")); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /MyDataBase/SendingMails/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace SendingMails 5 | { 6 | public class FilterConfig 7 | { 8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 9 | { 10 | filters.Add(new HandleErrorAttribute()); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /MyDataBase/SendingMails/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace SendingMails 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapRoute( 17 | name: "Default", 18 | url: "{controller}/{action}/{id}", 19 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 20 | ); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /MyDataBase/SendingMails/App_Start/WebApiConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net.Http; 5 | using System.Web.Http; 6 | using Microsoft.Owin.Security.OAuth; 7 | using Newtonsoft.Json.Serialization; 8 | 9 | namespace SendingMails 10 | { 11 | public static class WebApiConfig 12 | { 13 | public static void Register(HttpConfiguration config) 14 | { 15 | // Web API configuration and services 16 | // Configure Web API to use only bearer token authentication. 17 | config.SuppressDefaultHostAuthentication(); 18 | config.Filters.Add(new HostAuthenticationFilter(OAuthDefaults.AuthenticationType)); 19 | 20 | // Web API routes 21 | config.MapHttpAttributeRoutes(); 22 | 23 | config.Routes.MapHttpRoute( 24 | name: "DefaultApi", 25 | routeTemplate: "api/{controller}/{id}", 26 | defaults: new { id = RouteParameter.Optional } 27 | ); 28 | 29 | 30 | //route for sending mail 31 | config.Routes.MapHttpRoute( 32 | name: "SendMail", 33 | routeTemplate: "api/SendMail" 34 | ); 35 | 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/ApiDescriptionExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Web; 4 | using System.Web.Http.Description; 5 | 6 | namespace SendingMails.Areas.HelpPage 7 | { 8 | public static class ApiDescriptionExtensions 9 | { 10 | /// 11 | /// Generates an URI-friendly ID for the . E.g. "Get-Values-id_name" instead of "GetValues/{id}?name={name}" 12 | /// 13 | /// The . 14 | /// The ID as a string. 15 | public static string GetFriendlyId(this ApiDescription description) 16 | { 17 | string path = description.RelativePath; 18 | string[] urlParts = path.Split('?'); 19 | string localPath = urlParts[0]; 20 | string queryKeyString = null; 21 | if (urlParts.Length > 1) 22 | { 23 | string query = urlParts[1]; 24 | string[] queryKeys = HttpUtility.ParseQueryString(query).AllKeys; 25 | queryKeyString = String.Join("_", queryKeys); 26 | } 27 | 28 | StringBuilder friendlyPath = new StringBuilder(); 29 | friendlyPath.AppendFormat("{0}-{1}", 30 | description.HttpMethod.Method, 31 | localPath.Replace("/", "-").Replace("{", String.Empty).Replace("}", String.Empty)); 32 | if (queryKeyString != null) 33 | { 34 | friendlyPath.AppendFormat("_{0}", queryKeyString.Replace('.', '-')); 35 | } 36 | return friendlyPath.ToString(); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/HelpPageAreaRegistration.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using System.Web.Mvc; 3 | 4 | namespace SendingMails.Areas.HelpPage 5 | { 6 | public class HelpPageAreaRegistration : AreaRegistration 7 | { 8 | public override string AreaName 9 | { 10 | get 11 | { 12 | return "HelpPage"; 13 | } 14 | } 15 | 16 | public override void RegisterArea(AreaRegistrationContext context) 17 | { 18 | context.MapRoute( 19 | "HelpPage_Default", 20 | "Help/{action}/{apiId}", 21 | new { controller = "Help", action = "Index", apiId = UrlParameter.Optional }); 22 | 23 | HelpPageConfig.Register(GlobalConfiguration.Configuration); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/ModelDescriptions/CollectionModelDescription.cs: -------------------------------------------------------------------------------- 1 | namespace SendingMails.Areas.HelpPage.ModelDescriptions 2 | { 3 | public class CollectionModelDescription : ModelDescription 4 | { 5 | public ModelDescription ElementDescription { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/ModelDescriptions/ComplexTypeModelDescription.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.ObjectModel; 2 | 3 | namespace SendingMails.Areas.HelpPage.ModelDescriptions 4 | { 5 | public class ComplexTypeModelDescription : ModelDescription 6 | { 7 | public ComplexTypeModelDescription() 8 | { 9 | Properties = new Collection(); 10 | } 11 | 12 | public Collection Properties { get; private set; } 13 | } 14 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/ModelDescriptions/DictionaryModelDescription.cs: -------------------------------------------------------------------------------- 1 | namespace SendingMails.Areas.HelpPage.ModelDescriptions 2 | { 3 | public class DictionaryModelDescription : KeyValuePairModelDescription 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/ModelDescriptions/EnumTypeModelDescription.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Collections.ObjectModel; 3 | 4 | namespace SendingMails.Areas.HelpPage.ModelDescriptions 5 | { 6 | public class EnumTypeModelDescription : ModelDescription 7 | { 8 | public EnumTypeModelDescription() 9 | { 10 | Values = new Collection(); 11 | } 12 | 13 | public Collection Values { get; private set; } 14 | } 15 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/ModelDescriptions/EnumValueDescription.cs: -------------------------------------------------------------------------------- 1 | namespace SendingMails.Areas.HelpPage.ModelDescriptions 2 | { 3 | public class EnumValueDescription 4 | { 5 | public string Documentation { get; set; } 6 | 7 | public string Name { get; set; } 8 | 9 | public string Value { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/ModelDescriptions/IModelDocumentationProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | 4 | namespace SendingMails.Areas.HelpPage.ModelDescriptions 5 | { 6 | public interface IModelDocumentationProvider 7 | { 8 | string GetDocumentation(MemberInfo member); 9 | 10 | string GetDocumentation(Type type); 11 | } 12 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/ModelDescriptions/KeyValuePairModelDescription.cs: -------------------------------------------------------------------------------- 1 | namespace SendingMails.Areas.HelpPage.ModelDescriptions 2 | { 3 | public class KeyValuePairModelDescription : ModelDescription 4 | { 5 | public ModelDescription KeyModelDescription { get; set; } 6 | 7 | public ModelDescription ValueModelDescription { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/ModelDescriptions/ModelDescription.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SendingMails.Areas.HelpPage.ModelDescriptions 4 | { 5 | /// 6 | /// Describes a type model. 7 | /// 8 | public abstract class ModelDescription 9 | { 10 | public string Documentation { get; set; } 11 | 12 | public Type ModelType { get; set; } 13 | 14 | public string Name { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/ModelDescriptions/ModelNameAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SendingMails.Areas.HelpPage.ModelDescriptions 4 | { 5 | /// 6 | /// Use this attribute to change the name of the generated for a type. 7 | /// 8 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum, AllowMultiple = false, Inherited = false)] 9 | public sealed class ModelNameAttribute : Attribute 10 | { 11 | public ModelNameAttribute(string name) 12 | { 13 | Name = name; 14 | } 15 | 16 | public string Name { get; private set; } 17 | } 18 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/ModelDescriptions/ModelNameHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Linq; 4 | using System.Reflection; 5 | 6 | namespace SendingMails.Areas.HelpPage.ModelDescriptions 7 | { 8 | internal static class ModelNameHelper 9 | { 10 | // Modify this to provide custom model name mapping. 11 | public static string GetModelName(Type type) 12 | { 13 | ModelNameAttribute modelNameAttribute = type.GetCustomAttribute(); 14 | if (modelNameAttribute != null && !String.IsNullOrEmpty(modelNameAttribute.Name)) 15 | { 16 | return modelNameAttribute.Name; 17 | } 18 | 19 | string modelName = type.Name; 20 | if (type.IsGenericType) 21 | { 22 | // Format the generic type name to something like: GenericOfAgurment1AndArgument2 23 | Type genericType = type.GetGenericTypeDefinition(); 24 | Type[] genericArguments = type.GetGenericArguments(); 25 | string genericTypeName = genericType.Name; 26 | 27 | // Trim the generic parameter counts from the name 28 | genericTypeName = genericTypeName.Substring(0, genericTypeName.IndexOf('`')); 29 | string[] argumentTypeNames = genericArguments.Select(t => GetModelName(t)).ToArray(); 30 | modelName = String.Format(CultureInfo.InvariantCulture, "{0}Of{1}", genericTypeName, String.Join("And", argumentTypeNames)); 31 | } 32 | 33 | return modelName; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/ModelDescriptions/ParameterAnnotation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SendingMails.Areas.HelpPage.ModelDescriptions 4 | { 5 | public class ParameterAnnotation 6 | { 7 | public Attribute AnnotationAttribute { get; set; } 8 | 9 | public string Documentation { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/ModelDescriptions/ParameterDescription.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Collections.ObjectModel; 3 | 4 | namespace SendingMails.Areas.HelpPage.ModelDescriptions 5 | { 6 | public class ParameterDescription 7 | { 8 | public ParameterDescription() 9 | { 10 | Annotations = new Collection(); 11 | } 12 | 13 | public Collection Annotations { get; private set; } 14 | 15 | public string Documentation { get; set; } 16 | 17 | public string Name { get; set; } 18 | 19 | public ModelDescription TypeDescription { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/ModelDescriptions/SimpleTypeModelDescription.cs: -------------------------------------------------------------------------------- 1 | namespace SendingMails.Areas.HelpPage.ModelDescriptions 2 | { 3 | public class SimpleTypeModelDescription : ModelDescription 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/SampleGeneration/ImageSample.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SendingMails.Areas.HelpPage 4 | { 5 | /// 6 | /// This represents an image sample on the help page. There's a display template named ImageSample associated with this class. 7 | /// 8 | public class ImageSample 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | /// The URL of an image. 14 | public ImageSample(string src) 15 | { 16 | if (src == null) 17 | { 18 | throw new ArgumentNullException("src"); 19 | } 20 | Src = src; 21 | } 22 | 23 | public string Src { get; private set; } 24 | 25 | public override bool Equals(object obj) 26 | { 27 | ImageSample other = obj as ImageSample; 28 | return other != null && Src == other.Src; 29 | } 30 | 31 | public override int GetHashCode() 32 | { 33 | return Src.GetHashCode(); 34 | } 35 | 36 | public override string ToString() 37 | { 38 | return Src; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/SampleGeneration/InvalidSample.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SendingMails.Areas.HelpPage 4 | { 5 | /// 6 | /// This represents an invalid sample on the help page. There's a display template named InvalidSample associated with this class. 7 | /// 8 | public class InvalidSample 9 | { 10 | public InvalidSample(string errorMessage) 11 | { 12 | if (errorMessage == null) 13 | { 14 | throw new ArgumentNullException("errorMessage"); 15 | } 16 | ErrorMessage = errorMessage; 17 | } 18 | 19 | public string ErrorMessage { get; private set; } 20 | 21 | public override bool Equals(object obj) 22 | { 23 | InvalidSample other = obj as InvalidSample; 24 | return other != null && ErrorMessage == other.ErrorMessage; 25 | } 26 | 27 | public override int GetHashCode() 28 | { 29 | return ErrorMessage.GetHashCode(); 30 | } 31 | 32 | public override string ToString() 33 | { 34 | return ErrorMessage; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/SampleGeneration/SampleDirection.cs: -------------------------------------------------------------------------------- 1 | namespace SendingMails.Areas.HelpPage 2 | { 3 | /// 4 | /// Indicates whether the sample is used for request or response 5 | /// 6 | public enum SampleDirection 7 | { 8 | Request = 0, 9 | Response 10 | } 11 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/SampleGeneration/TextSample.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SendingMails.Areas.HelpPage 4 | { 5 | /// 6 | /// This represents a preformatted text sample on the help page. There's a display template named TextSample associated with this class. 7 | /// 8 | public class TextSample 9 | { 10 | public TextSample(string text) 11 | { 12 | if (text == null) 13 | { 14 | throw new ArgumentNullException("text"); 15 | } 16 | Text = text; 17 | } 18 | 19 | public string Text { get; private set; } 20 | 21 | public override bool Equals(object obj) 22 | { 23 | TextSample other = obj as TextSample; 24 | return other != null && Text == other.Text; 25 | } 26 | 27 | public override int GetHashCode() 28 | { 29 | return Text.GetHashCode(); 30 | } 31 | 32 | public override string ToString() 33 | { 34 | return Text; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/Views/Help/Api.cshtml: -------------------------------------------------------------------------------- 1 | @using System.Web.Http 2 | @using SendingMails.Areas.HelpPage.Models 3 | @model HelpPageApiModel 4 | 5 | @{ 6 | var description = Model.ApiDescription; 7 | ViewBag.Title = description.HttpMethod.Method + " " + description.RelativePath; 8 | } 9 | 10 | 11 |
12 | 19 |
20 | @Html.DisplayForModel() 21 |
22 |
23 | -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/Views/Help/DisplayTemplates/ApiGroup.cshtml: -------------------------------------------------------------------------------- 1 | @using System.Web.Http 2 | @using System.Web.Http.Controllers 3 | @using System.Web.Http.Description 4 | @using SendingMails.Areas.HelpPage 5 | @using SendingMails.Areas.HelpPage.Models 6 | @model IGrouping 7 | 8 | @{ 9 | var controllerDocumentation = ViewBag.DocumentationProvider != null ? 10 | ViewBag.DocumentationProvider.GetDocumentation(Model.Key) : 11 | null; 12 | } 13 | 14 |

@Model.Key.ControllerName

15 | @if (!String.IsNullOrEmpty(controllerDocumentation)) 16 | { 17 |

@controllerDocumentation

18 | } 19 | 20 | 21 | 22 | 23 | 24 | @foreach (var api in Model) 25 | { 26 | 27 | 28 | 38 | 39 | } 40 | 41 |
APIDescription
@api.HttpMethod.Method @api.RelativePath 29 | @if (api.Documentation != null) 30 | { 31 |

@api.Documentation

32 | } 33 | else 34 | { 35 |

No documentation available.

36 | } 37 |
-------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/Views/Help/DisplayTemplates/CollectionModelDescription.cshtml: -------------------------------------------------------------------------------- 1 | @using SendingMails.Areas.HelpPage.ModelDescriptions 2 | @model CollectionModelDescription 3 | @if (Model.ElementDescription is ComplexTypeModelDescription) 4 | { 5 | @Html.DisplayFor(m => m.ElementDescription) 6 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/Views/Help/DisplayTemplates/ComplexTypeModelDescription.cshtml: -------------------------------------------------------------------------------- 1 | @using SendingMails.Areas.HelpPage.ModelDescriptions 2 | @model ComplexTypeModelDescription 3 | @Html.DisplayFor(m => m.Properties, "Parameters") -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/Views/Help/DisplayTemplates/DictionaryModelDescription.cshtml: -------------------------------------------------------------------------------- 1 | @using SendingMails.Areas.HelpPage.ModelDescriptions 2 | @model DictionaryModelDescription 3 | Dictionary of @Html.DisplayFor(m => Model.KeyModelDescription.ModelType, "ModelDescriptionLink", new { modelDescription = Model.KeyModelDescription }) [key] 4 | and @Html.DisplayFor(m => Model.ValueModelDescription.ModelType, "ModelDescriptionLink", new { modelDescription = Model.ValueModelDescription }) [value] -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/Views/Help/DisplayTemplates/EnumTypeModelDescription.cshtml: -------------------------------------------------------------------------------- 1 | @using SendingMails.Areas.HelpPage.ModelDescriptions 2 | @model EnumTypeModelDescription 3 | 4 |

Possible enumeration values:

5 | 6 | 7 | 8 | 9 | 10 | 11 | @foreach (EnumValueDescription value in Model.Values) 12 | { 13 | 14 | 15 | 18 | 21 | 22 | } 23 | 24 |
NameValueDescription
@value.Name 16 |

@value.Value

17 |
19 |

@value.Documentation

20 |
-------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/Views/Help/DisplayTemplates/ImageSample.cshtml: -------------------------------------------------------------------------------- 1 | @using SendingMails.Areas.HelpPage 2 | @model ImageSample 3 | 4 | -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/Views/Help/DisplayTemplates/InvalidSample.cshtml: -------------------------------------------------------------------------------- 1 | @using SendingMails.Areas.HelpPage 2 | @model InvalidSample 3 | 4 | @if (HttpContext.Current.IsDebuggingEnabled) 5 | { 6 |
7 |

@Model.ErrorMessage

8 |
9 | } 10 | else 11 | { 12 |

Sample not available.

13 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/Views/Help/DisplayTemplates/KeyValuePairModelDescription.cshtml: -------------------------------------------------------------------------------- 1 | @using SendingMails.Areas.HelpPage.ModelDescriptions 2 | @model KeyValuePairModelDescription 3 | Pair of @Html.DisplayFor(m => Model.KeyModelDescription.ModelType, "ModelDescriptionLink", new { modelDescription = Model.KeyModelDescription }) [key] 4 | and @Html.DisplayFor(m => Model.ValueModelDescription.ModelType, "ModelDescriptionLink", new { modelDescription = Model.ValueModelDescription }) [value] -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/Views/Help/DisplayTemplates/ModelDescriptionLink.cshtml: -------------------------------------------------------------------------------- 1 | @using SendingMails.Areas.HelpPage.ModelDescriptions 2 | @model Type 3 | @{ 4 | ModelDescription modelDescription = ViewBag.modelDescription; 5 | if (modelDescription is ComplexTypeModelDescription || modelDescription is EnumTypeModelDescription) 6 | { 7 | if (Model == typeof(Object)) 8 | { 9 | @:Object 10 | } 11 | else 12 | { 13 | @Html.ActionLink(modelDescription.Name, "ResourceModel", "Help", new { modelName = modelDescription.Name }, null) 14 | } 15 | } 16 | else if (modelDescription is CollectionModelDescription) 17 | { 18 | var collectionDescription = modelDescription as CollectionModelDescription; 19 | var elementDescription = collectionDescription.ElementDescription; 20 | @:Collection of @Html.DisplayFor(m => elementDescription.ModelType, "ModelDescriptionLink", new { modelDescription = elementDescription }) 21 | } 22 | else 23 | { 24 | @Html.DisplayFor(m => modelDescription) 25 | } 26 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/Views/Help/DisplayTemplates/Samples.cshtml: -------------------------------------------------------------------------------- 1 | @using System.Net.Http.Headers 2 | @model Dictionary 3 | 4 | @{ 5 | // Group the samples into a single tab if they are the same. 6 | Dictionary samples = Model.GroupBy(pair => pair.Value).ToDictionary( 7 | pair => String.Join(", ", pair.Select(m => m.Key.ToString()).ToArray()), 8 | pair => pair.Key); 9 | var mediaTypes = samples.Keys; 10 | } 11 |
12 | @foreach (var mediaType in mediaTypes) 13 | { 14 |

@mediaType

15 |
16 | Sample: 17 | @{ 18 | var sample = samples[mediaType]; 19 | if (sample == null) 20 | { 21 |

Sample not available.

22 | } 23 | else 24 | { 25 | @Html.DisplayFor(s => sample); 26 | } 27 | } 28 |
29 | } 30 |
-------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/Views/Help/DisplayTemplates/SimpleTypeModelDescription.cshtml: -------------------------------------------------------------------------------- 1 | @using SendingMails.Areas.HelpPage.ModelDescriptions 2 | @model SimpleTypeModelDescription 3 | @Model.Documentation -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/Views/Help/DisplayTemplates/TextSample.cshtml: -------------------------------------------------------------------------------- 1 | @using SendingMails.Areas.HelpPage 2 | @model TextSample 3 | 4 |
5 | @Model.Text
6 | 
-------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/Views/Help/Index.cshtml: -------------------------------------------------------------------------------- 1 | @using System.Web.Http 2 | @using System.Web.Http.Controllers 3 | @using System.Web.Http.Description 4 | @using System.Collections.ObjectModel 5 | @using SendingMails.Areas.HelpPage.Models 6 | @model Collection 7 | 8 | @{ 9 | ViewBag.Title = "ASP.NET Web API Help Page"; 10 | 11 | // Group APIs by controller 12 | ILookup apiGroups = Model.ToLookup(api => api.ActionDescriptor.ControllerDescriptor); 13 | } 14 | 15 | 16 |
17 |
18 |
19 |

@ViewBag.Title

20 |
21 |
22 |
23 |
24 | 32 |
33 | @foreach (var group in apiGroups) 34 | { 35 | @Html.DisplayFor(m => group, "ApiGroup") 36 | } 37 |
38 |
39 | -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/Views/Help/ResourceModel.cshtml: -------------------------------------------------------------------------------- 1 | @using System.Web.Http 2 | @using SendingMails.Areas.HelpPage.ModelDescriptions 3 | @model ModelDescription 4 | 5 | 6 |
7 | 14 |

@Model.Name

15 |

@Model.Documentation

16 |
17 | @Html.DisplayFor(m => Model) 18 |
19 |
20 | -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | @ViewBag.Title 7 | @RenderSection("scripts", required: false) 8 | 9 | 10 | @RenderBody() 11 | 12 | -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Areas/HelpPage/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | // Change the Layout path below to blend the look and feel of the help page with your existing web pages 3 | Layout = "~/Views/Shared/_Layout.cshtml"; 4 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Content/Site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | padding-bottom: 20px; 4 | } 5 | 6 | /* Set padding to keep content from hitting the edges */ 7 | .body-content { 8 | padding-left: 15px; 9 | padding-right: 15px; 10 | } 11 | 12 | /* Set width on the form input elements since they're 100% wide by default */ 13 | input, 14 | select, 15 | textarea { 16 | max-width: 280px; 17 | } 18 | -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace SendingMails.Controllers 8 | { 9 | public class HomeController : Controller 10 | { 11 | public ActionResult Index() 12 | { 13 | ViewBag.Title = "Home Page"; 14 | 15 | return View(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Controllers/MailController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace SendingMails.Controllers 8 | { 9 | public class MailController : Controller 10 | { 11 | [HttpPost] 12 | public void SendTo(string mail) 13 | { 14 | 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Controllers/ValuesController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net; 5 | using System.Net.Http; 6 | using System.Web.Http; 7 | 8 | namespace SendingMails.Controllers 9 | { 10 | [Authorize] 11 | public class ValuesController : ApiController 12 | { 13 | // GET api/values 14 | public IEnumerable Get() 15 | { 16 | return new string[] { "value1", "value2" }; 17 | } 18 | 19 | // GET api/values/5 20 | public string Get(int id) 21 | { 22 | return "value"; 23 | } 24 | 25 | // POST api/values 26 | public void Post([FromBody]string value) 27 | { 28 | } 29 | 30 | // PUT api/values/5 31 | public void Put(int id, [FromBody]string value) 32 | { 33 | } 34 | 35 | // DELETE api/values/5 36 | public void Delete(int id) 37 | { 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="SendingMails.WebApiApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Http; 6 | using System.Web.Mvc; 7 | using System.Web.Optimization; 8 | using System.Web.Routing; 9 | 10 | namespace SendingMails 11 | { 12 | public class WebApiApplication : System.Web.HttpApplication 13 | { 14 | protected void Application_Start() 15 | { 16 | AreaRegistration.RegisterAllAreas(); 17 | GlobalConfiguration.Configure(WebApiConfig.Register); 18 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 19 | RouteConfig.RegisterRoutes(RouteTable.Routes); 20 | BundleConfig.RegisterBundles(BundleTable.Bundles); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Models/AccountViewModels.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace SendingMails.Models 5 | { 6 | // Models returned by AccountController actions. 7 | 8 | public class ExternalLoginViewModel 9 | { 10 | public string Name { get; set; } 11 | 12 | public string Url { get; set; } 13 | 14 | public string State { get; set; } 15 | } 16 | 17 | public class ManageInfoViewModel 18 | { 19 | public string LocalLoginProvider { get; set; } 20 | 21 | public string Email { get; set; } 22 | 23 | public IEnumerable Logins { get; set; } 24 | 25 | public IEnumerable ExternalLoginProviders { get; set; } 26 | } 27 | 28 | public class UserInfoViewModel 29 | { 30 | public string Email { get; set; } 31 | 32 | public bool HasRegistered { get; set; } 33 | 34 | public string LoginProvider { get; set; } 35 | } 36 | 37 | public class UserLoginInfoViewModel 38 | { 39 | public string LoginProvider { get; set; } 40 | 41 | public string ProviderKey { get; set; } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Models/IdentityModels.cs: -------------------------------------------------------------------------------- 1 | using System.Security.Claims; 2 | using System.Threading.Tasks; 3 | using Microsoft.AspNet.Identity; 4 | using Microsoft.AspNet.Identity.EntityFramework; 5 | using Microsoft.AspNet.Identity.Owin; 6 | 7 | namespace SendingMails.Models 8 | { 9 | // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more. 10 | public class ApplicationUser : IdentityUser 11 | { 12 | public async Task GenerateUserIdentityAsync(UserManager manager, string authenticationType) 13 | { 14 | // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType 15 | var userIdentity = await manager.CreateIdentityAsync(this, authenticationType); 16 | // Add custom user claims here 17 | return userIdentity; 18 | } 19 | } 20 | 21 | public class ApplicationDbContext : IdentityDbContext 22 | { 23 | public ApplicationDbContext() 24 | : base("DefaultConnection", throwIfV1Schema: false) 25 | { 26 | } 27 | 28 | public static ApplicationDbContext Create() 29 | { 30 | return new ApplicationDbContext(); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SendingMails")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("SendingMails")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("5956cd3d-8077-4c88-b12f-f9129b3aa5a8")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Results/ChallengeResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net; 5 | using System.Net.Http; 6 | using System.Threading; 7 | using System.Threading.Tasks; 8 | using System.Web.Http; 9 | 10 | namespace SendingMails.Results 11 | { 12 | public class ChallengeResult : IHttpActionResult 13 | { 14 | public ChallengeResult(string loginProvider, ApiController controller) 15 | { 16 | LoginProvider = loginProvider; 17 | Request = controller.Request; 18 | } 19 | 20 | public string LoginProvider { get; set; } 21 | public HttpRequestMessage Request { get; set; } 22 | 23 | public Task ExecuteAsync(CancellationToken cancellationToken) 24 | { 25 | Request.GetOwinContext().Authentication.Challenge(LoginProvider); 26 | 27 | HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.Unauthorized); 28 | response.RequestMessage = Request; 29 | return Task.FromResult(response); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Scripts/_references.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/merisahakyan/UsefulExamples/507a2d5da4d401328578d5884ee74dee64ed5392/MyDataBase/SendingMails/Scripts/_references.js -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Startup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Microsoft.Owin; 5 | using Owin; 6 | 7 | [assembly: OwinStartup(typeof(SendingMails.Startup))] 8 | 9 | namespace SendingMails 10 | { 11 | public partial class Startup 12 | { 13 | public void Configuration(IAppBuilder app) 14 | { 15 | ConfigureAuth(app); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | 
2 |

ASP.NET

3 |

ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS, and JavaScript.

4 |

Learn more »

5 |
6 |
7 |
8 |

Getting started

9 |

ASP.NET Web API is a framework that makes it easy to build HTTP services that reach 10 | a broad range of clients, including browsers and mobile devices. ASP.NET Web API 11 | is an ideal platform for building RESTful applications on the .NET Framework.

12 |

Learn more »

13 |
14 |
15 |

Get more libraries

16 |

NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.

17 |

Learn more »

18 |
19 |
20 |

Web Hosting

21 |

You can easily find a web hosting company that offers the right mix of features and price for your applications.

22 |

Learn more »

23 |
24 |
25 | -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Error 6 | 7 | 8 |
9 |

Error.

10 |

An error occurred while processing your request.

11 |
12 | 13 | 14 | -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | @ViewBag.Title 7 | @Styles.Render("~/Content/css") 8 | @Scripts.Render("~/bundles/modernizr") 9 | 10 | 11 | 29 |
30 | @RenderBody() 31 |
32 |
33 |

© @DateTime.Now.Year - My ASP.NET Application

34 |
35 |
36 | 37 | @Scripts.Render("~/bundles/jquery") 38 | @Scripts.Render("~/bundles/bootstrap") 39 | @RenderSection("scripts", required: false) 40 | 41 | 42 | -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /MyDataBase/SendingMails/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /MyDataBase/SendingMails/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/merisahakyan/UsefulExamples/507a2d5da4d401328578d5884ee74dee64ed5392/MyDataBase/SendingMails/favicon.ico -------------------------------------------------------------------------------- /MyDataBase/SendingMails/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/merisahakyan/UsefulExamples/507a2d5da4d401328578d5884ee74dee64ed5392/MyDataBase/SendingMails/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /MyDataBase/SendingMails/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/merisahakyan/UsefulExamples/507a2d5da4d401328578d5884ee74dee64ed5392/MyDataBase/SendingMails/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /MyDataBase/SendingMails/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/merisahakyan/UsefulExamples/507a2d5da4d401328578d5884ee74dee64ed5392/MyDataBase/SendingMails/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /ObjectToFile/ObjectToFile.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ObjectToFile", "ObjectToFile\ObjectToFile.csproj", "{808B8F7E-D761-4DAE-A29A-AE1620D26940}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {808B8F7E-D761-4DAE-A29A-AE1620D26940}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {808B8F7E-D761-4DAE-A29A-AE1620D26940}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {808B8F7E-D761-4DAE-A29A-AE1620D26940}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {808B8F7E-D761-4DAE-A29A-AE1620D26940}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /ObjectToFile/ObjectToFile/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ObjectToFile")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ObjectToFile")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("808b8f7e-d761-4dae-a29a-ae1620d26940")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Useful examples for understanding OOP in **c#** 2 | * [DirectoryTree for getting folders and files from given directory](https://github.com/marysahakyan/UsefulExamples/tree/master/DirectoryTree) 3 | * [Geometric vectors addition and subtraction. Operators overloading](https://github.com/marysahakyan/UsefulExamples/tree/master/Vectors_OverloadingOperators%2B-) 4 | * [File Class, Exception Handling](https://github.com/marysahakyan/UsefulExamples/tree/master/ExceptionHandling) 5 | * [CrazyButton](https://github.com/merisahakyan/UsefulExamples/tree/master/CrazyButton) 6 | * [Events and Delegates](https://github.com/merisahakyan/UsefulExamples/tree/master/EventsAndDelegates) 7 | * [New MyLINQ exstensions like LINQ](https://github.com/merisahakyan/UsefulExamples/tree/master/HandMadeLINQ) 8 | * [Iterators,IEnumerable and IEnumerator interfaces](https://github.com/merisahakyan/UsefulExamples/tree/master/ImplementingIterators) 9 | * [IndexersDemo with class Dictionary<>](https://github.com/marysahakyan/UsefulExamples/tree/master/IndexersDemo) 10 | * [Asyncronous Programming,async await keywords,TPL](https://github.com/merisahakyan/UsefulExamples/tree/master/AsyncronousProgramming) 11 | * [System.Reflection class library](https://github.com/merisahakyan/UsefulExamples/tree/master/ReflectionDemo) 12 | * [Regular Expressions](https://github.com/merisahakyan/UsefulExamples/tree/master/RegularEx) 13 |
14 | 15 | ![Bruce](https://github.com/marysahakyan/UsefulExamples/blob/master/bruce.gif) 16 | -------------------------------------------------------------------------------- /ReadingFromExcel/ReadingFromExcel.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReadingFromExcel", "ReadingFromExcel\ReadingFromExcel.csproj", "{39558BD7-99CA-48E4-BD56-F64C51E22A98}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SendingEmails", "SendingEmails\SendingEmails.csproj", "{937A777E-6683-4454-923B-310208581F75}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {39558BD7-99CA-48E4-BD56-F64C51E22A98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {39558BD7-99CA-48E4-BD56-F64C51E22A98}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {39558BD7-99CA-48E4-BD56-F64C51E22A98}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {39558BD7-99CA-48E4-BD56-F64C51E22A98}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {937A777E-6683-4454-923B-310208581F75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {937A777E-6683-4454-923B-310208581F75}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {937A777E-6683-4454-923B-310208581F75}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {937A777E-6683-4454-923B-310208581F75}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /ReadingFromExcel/ReadingFromExcel/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /ReadingFromExcel/ReadingFromExcel/Contact.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace ReadingFromExcel 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class Contact 16 | { 17 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] 18 | public Contact() 19 | { 20 | this.EmailLists = new HashSet(); 21 | } 22 | 23 | public int ContactId { get; set; } 24 | public string FullName { get; set; } 25 | public string CompanyName { get; set; } 26 | public string Position { get; set; } 27 | public string Country { get; set; } 28 | public string Email { get; set; } 29 | public System.Guid GuID { get; set; } 30 | public System.DateTime DateInserted { get; set; } 31 | 32 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 33 | public virtual ICollection EmailLists { get; set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ReadingFromExcel/ReadingFromExcel/EmailList.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace ReadingFromExcel 11 | { 12 | using System; 13 | using System.Collections.Generic; 14 | 15 | public partial class EmailList 16 | { 17 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] 18 | public EmailList() 19 | { 20 | this.Contacts = new HashSet(); 21 | } 22 | 23 | public int EmailListID { get; set; } 24 | public string EmailListName { get; set; } 25 | 26 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] 27 | public virtual ICollection Contacts { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ReadingFromExcel/ReadingFromExcel/Model1.Context.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated from a template. 4 | // 5 | // Manual changes to this file may cause unexpected behavior in your application. 6 | // Manual changes to this file will be overwritten if the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace ReadingFromExcel 11 | { 12 | using System; 13 | using System.Data.Entity; 14 | using System.Data.Entity.Infrastructure; 15 | 16 | public partial class CRMContext : DbContext 17 | { 18 | public CRMContext() 19 | : base("name=CRMContext") 20 | { 21 | } 22 | 23 | protected override void OnModelCreating(DbModelBuilder modelBuilder) 24 | { 25 | throw new UnintentionalCodeFirstException(); 26 | } 27 | 28 | public virtual DbSet Contacts { get; set; } 29 | public virtual DbSet EmailLists { get; set; } 30 | public virtual DbSet