This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Example12_4.cs illustrates the use of an event | |
*/ | |
using System; | |
// declare the MeltdownEventArgs class (implements EventArgs) | |
public class MeltdownEventArgs : EventArgs | |
{ | |
// declare a private field named message | |
private string message; | |
// define a constructor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
namespace TestConsole | |
{ | |
public class Book | |
{ | |
public int Id { get; set; } | |
public string Title { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<feed xmlns="http://www.w3.org/2005/Atom"> | |
<title>Mobile Essentials Gallery</title> | |
<id>MobileEssentials</id> | |
<updated>2015-06-28T12:50:07.4556340+00:00</updated> | |
<entry> | |
<id>Xamarin.CocosSharpTemplates</id> | |
<title>CocosSharpTemplates</title> | |
<summary>CocosSharp is a C# implementation of the Cocos2D APIs that runs on any platform where MonoGame runs. This will install a collection of CocosSharp Project Templates that allows for the creation of a simple CocosSharp minimal skeleton game solution and project to get developers up and running fast.</summary> | |
<published>2015-06-28T12:49:12.9106912Z</published> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyClass | |
{ | |
public int RowNo { get; set; } | |
public int Value { get; set; } | |
} | |
public static class LinqEx | |
{ | |
public static IEnumerable<T> Project<T>(this IEnumerable<T> lst1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class NiceLinq | |
{ | |
public static IEnumerable<T> OrderBy<T>(this IEnumerable<T> notOrderedList, string propertyName) | |
{ | |
var lambda = GetLambda<T>(propertyName); | |
var orderedList = notOrderedList.OrderBy(lambda); | |
return orderedList; | |
} | |
private static Func<T, object> GetLambda<T>(string propertyName) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IEnumerable<T> InterlockWith<T>(this IEnumerable<T> seq1, IEnumerable<T> seq2) | |
{ | |
Tuple<T[], int>[] metaSequences = new Tuple<T[], int>[2]; | |
metaSequences[0] = Tuple.Create(seq1.ToArray(), seq1.Count()); | |
metaSequences[1] = Tuple.Create(seq2.ToArray(), seq2.Count()); | |
var orderedMetas = metaSequences.OrderBy(x => x.Item2).ToArray(); | |
for (int i = 0; i < orderedMetas[0].Item2; i++) | |
{ | |
yield return metaSequences[0].Item1[i]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IQueryable<T> SelectExcept<T, TKey>(this IQueryable<T> sequence, | |
Expression<Func<T, TKey>> excluder) where T : new() | |
{ | |
List<string> excludedProperties = new List<string>(); | |
if (excluder.Body is MemberExpression memberExpression) | |
{ | |
excludedProperties.Add(memberExpression.Member.Name); | |
} | |
else if (excluder.Body is NewExpression anonymousExpression) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//credits to Zoran Horvat, author of Making Your C# Code More Object-oriented course. | |
namespace MakingYourCSharpCodeMoreObjectOriented | |
{ | |
public class Option<T> : IOption<T> | |
{ | |
private IEnumerable<T> Content { get; } | |
private Option(IEnumerable<T> content) | |
{ | |
Content = content; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//challeng 1 | |
string names = "Davis, Clyne, Fonte, Hooiveld, Shaw, Davis, Schneiderlin, Cork, Lallana, Rodriguez, Lambert"; | |
var team = names.Split(',').Select((player, index) => (index + 1) + ". " + player.Trim()).Aggregate((curr, next) => curr + ", " + next); | |
//challenge 2 (see answer) | |
string playersData = "Jason Puncheon, 26/06/1986; Jos Hooiveld, 22/04/1983; Kelvin Davis, 29/09/1976; Luke Shaw, 12/07/1995; " + | |
"Gaston Ramirez, 02/12/1990; Adam Lallana, 10/05/1988"; | |
var players = playersData.Split(';').Select(player => (Name: player.Trim().Substring(0, player.IndexOf(',') - 1), DoB: DateTime.ParseExact(player.Substring(player.IndexOf(',') + 1).Trim(), "dd/MM/yyyy", CultureInfo.InvariantCulture))).Select(x => new { x.Name, x.DoB, Age = DateTime.Now.Year - x.Item2.Year }).OrderBy(x => x.Age).ToList(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<meta name="robots" content="noindex, nofollow"> | |
<meta name="googlebot" content="noindex"> | |
<link rel="shortcut icon" href="https://www.paytabs.com/images/favicon.png" /> | |
<title>PayTabs - موثوقة و طريقة دفع سهلة</title> |
OlderNewer