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
foreach (ModelError error in modelState.Errors.Where(err => String.IsNullOrEmpty(err.ErrorMessage) && err.Exception != null).ToList()) | |
{ | |
for (Exception exception = error.Exception; exception != null; exception = exception.InnerException) | |
{ | |
// We only consider "known" type of exception and do not make too aggressive changes here | |
if (exception is FormatException || exception is OverflowException) | |
{ | |
string displayName = propertyMetadata.GetDisplayName(); | |
string errorMessageTemplate = GetValueInvalidResource(controllerContext); |
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 class UserModel | |
{ | |
public string Name; | |
public string Age; | |
public string City; | |
} |
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
var results = users.SelectMany(p => p.Departments, (user, departement) => new Tuple<string, string>(user.Name, departement.Name)); | |
foreach(var userAndDepartment in results) | |
{ | |
Console.WriteLine(string.Format("User: {0} - Department: {1}", userAndDepartment.Item1, userAndDepartment.Item2)); | |
} | |
Console.ReadKey(); |
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
var departments = new List<Department>(); | |
foreach(var user in users) | |
{ | |
departments.AddRange(user.Departments); | |
} |
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 class User | |
{ | |
public Guid Id { get; set; } | |
public string Name { get; set; } | |
public List<Department> Departments { get; set; } | |
} | |
public class Department | |
{ | |
public Guid Id { 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
# imports and basic notebook setup | |
from cStringIO import StringIO | |
import numpy as np | |
import scipy.ndimage as nd | |
import PIL.Image | |
from IPython.display import clear_output, Image, display | |
from google.protobuf import text_format | |
import caffe |
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 class User | |
{ | |
public string FirstName { get; set; } | |
public string LastName { get; set; } | |
public LoginInformation LoginInformation { get; set; } | |
public class Comparer : IEqualityComparer<User> | |
{ | |
public bool Equals(User x, User y) |
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 Program | |
{ | |
static void Main(string[] args) | |
{ | |
var users = new List<User> | |
{ | |
new User | |
{ | |
FirstName = "Pascal", | |
LastName = "Paradis", |
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
namespace FrenchCoding.Consume | |
{ | |
using Obsolete; | |
using System.Collections.Generic; | |
public class UserSearchEngine | |
{ | |
public List<string> SearchUsers(string query) | |
{ | |
var directory = new UserDirectory(); |
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.Collections.Generic; | |
namespace FrenchCoding.Obsolete | |
{ | |
public class UserDirectory | |
{ | |
public List<string> GetAllUsers() | |
{ | |
return new List<string>(); | |
} |