This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public static class QueryableExtensions | |
| { | |
| public static IQueryable<TResult> Select<TResult>(this IQueryable source, string[] columns) | |
| { | |
| var sourceType = source.ElementType; | |
| var resultType = typeof(TResult); | |
| var parameter = Expression.Parameter(sourceType, "e"); | |
| var bindings = columns.Select(column => Expression.Bind( | |
| resultType.GetProperty(column), Expression.PropertyOrField(parameter, column))); | |
| var body = Expression.MemberInit(Expression.New(resultType), bindings); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | namespace Linq.Example.Tests | |
| { | |
| [TestClass] | |
| public class UnitTest1 | |
| { | |
| [TestMethod] | |
| public void TestMethod1() | |
| { | |
| var itemList = new List<Item>() | |
| { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | private static IEnumerable<KeyValuePair<ConstantExpression, Expression>> GetPropertyExpressionsWithAllProperties(this ParameterExpression parameterExpression) | |
| { | |
| IEnumerable<string> propertiesToProvide = parameterExpression.Type.GetProperties().Select(r => r.Name); | |
| return parameterExpression.GetPropertyExpressionsWithOnlyProvidedProperties(propertiesToProvide); | |
| } | |
| private static IEnumerable<KeyValuePair<ConstantExpression, Expression>> GetPropertyExpressionsWithOnlyProvidedProperties(this ParameterExpression parameterExpression, IEnumerable<string> providedProperties) | |
| { | |
| // Iterate through all properties for the source parameter expression type. | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public static object GetDefault(this Type targetType) | |
| => targetType.IsValueType ? Activator.CreateInstance(targetType) : null; | |
| public static MemberExpression GetPropertyExpression(this ParameterExpression parameterExpression, string propertyName) | |
| { | |
| // Get source type from parameter expression. | |
| Type sourceType = parameterExpression.Type; | |
| Debug.WriteLine($"Source Type: {sourceType.ToString()}"); | |
| // Get property information from source type. | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | using System; | |
| namespace Wieldy.Net.Sockets | |
| { | |
| /// <summary> | |
| /// Socket using 'SocketAsyncEventArgs' to communicate from client to server. | |
| /// </summary> | |
| public sealed partial class Socket | |
| { | |
| private readonly System.Net.Sockets.ProtocolType _protocol; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /* | |
| IDisposable.h | |
| @purpose | |
| An interface which allows for objects to be disposed. | |
| Working with the RAII idiom, the dispose method should be called in the deconstructor of objects which inherit from it. | |
| @author | |
| Joshua Thompson | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /* | |
| Singleton.h | |
| @purpose | |
| Singleton template class used to create a singleton object. | |
| @author | |
| Joshua Thompson | |
| @modified | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | body { | |
| margin-top: 60px; | |
| font-size: 14px; | |
| font-family: "Helvetica Nueue",Arial,Verdana,sans-serif; | |
| background-color: #E5E9ED; | |
| } | |
| .btn:hover, | |
| .btn:focus, | |
| .btn:active{ | |
| outline: 0 !important; | 
OlderNewer