Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/System.Linq.Queryable/System.Linq.Queryable.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Linq.Queryable", "src\System.Linq.Queryable.csproj", "{BE12B753-C130-4B68-86E3-877F1AEE52C0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Linq.Queryable.Tests", "tests\System.Linq.Queryable.Tests.csproj", "{7B88D79B-B799-4116-A7D0-AED572540CD4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BE12B753-C130-4B68-86E3-877F1AEE52C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BE12B753-C130-4B68-86E3-877F1AEE52C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BE12B753-C130-4B68-86E3-877F1AEE52C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BE12B753-C130-4B68-86E3-877F1AEE52C0}.Release|Any CPU.Build.0 = Release|Any CPU
{7B88D79B-B799-4116-A7D0-AED572540CD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7B88D79B-B799-4116-A7D0-AED572540CD4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B88D79B-B799-4116-A7D0-AED572540CD4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B88D79B-B799-4116-A7D0-AED572540CD4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
51 changes: 51 additions & 0 deletions src/System.Linq.Queryable/src/Resources/SR.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Do not edit this file manually it is auto-generated during the build based on the .resx file for this project.
namespace System
{
internal static partial class SR
{
#pragma warning disable 0414
private const string s_resourcesName = "System.Linq.Queryable.resources"; // assembly Name + .resources
#pragma warning restore 0414

#if !DEBUGRESOURCES
internal static string ArgumentNotIEnumerableGeneric {
get { return SR.GetResourceString("ArgumentNotIEnumerableGeneric", null); }
}
internal static string UnhandledExpressionType {
get { return SR.GetResourceString("UnhandledExpressionType", null); }
}
internal static string UnhandledBindingType {
get { return SR.GetResourceString("UnhandledBindingType", null); }
}
internal static string ArgumentNotValid {
get { return SR.GetResourceString("ArgumentNotValid", null); }
}
internal static string NoMethodOnType {
get { return SR.GetResourceString("NoMethodOnType", null); }
}
internal static string NoMethodOnTypeMatchingArguments {
get { return SR.GetResourceString("NoMethodOnTypeMatchingArguments", null); }
}
#else
internal static string ArgumentNotIEnumerableGeneric {
get { return SR.GetResourceString("ArgumentNotIEnumerableGeneric", @"{0} is not IEnumerable<>"); }
}
internal static string UnhandledExpressionType {
get { return SR.GetResourceString("UnhandledExpressionType", @"Unhandled Expression Type: {0}"); }
}
internal static string UnhandledBindingType {
get { return SR.GetResourceString("UnhandledBindingType", @"Unhandled Binding Type: {0}"); }
}
internal static string ArgumentNotValid {
get { return SR.GetResourceString("ArgumentNotValid", @"Argument {0} is not valid"); }
}
internal static string NoMethodOnType {
get { return SR.GetResourceString("NoMethodOnType", @"There is no method '{0}' on type '{1}'"); }
}
internal static string NoMethodOnTypeMatchingArguments {
get { return SR.GetResourceString("NoMethodOnTypeMatchingArguments", @"There is no method '{0}' on type '{1}' that matches the specified arguments"); }
}

#endif
}
}
138 changes: 138 additions & 0 deletions src/System.Linq.Queryable/src/Resources/Strings.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema

Version 2.0

The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.

Example:

... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>

There are any number of "resheader" rows that contain simple
name/value pairs.

Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.

The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:

Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.

mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="ArgumentNotIEnumerableGeneric" xml:space="preserve">
<value>{0} is not IEnumerable&lt;&gt;</value>
</data>
<data name="UnhandledExpressionType" xml:space="preserve">
<value>Unhandled Expression Type: {0}</value>
</data>
<data name="UnhandledBindingType" xml:space="preserve">
<value>Unhandled Binding Type: {0}</value>
</data>
<data name="ArgumentNotValid" xml:space="preserve">
<value>Argument {0} is not valid</value>
</data>
<data name="NoMethodOnType" xml:space="preserve">
<value>There is no method '{0}' on type '{1}'</value>
</data>
<data name="NoMethodOnTypeMatchingArguments" xml:space="preserve">
<value>There is no method '{0}' on type '{1}' that matches the specified arguments</value>
</data>
</root>
35 changes: 35 additions & 0 deletions src/System.Linq.Queryable/src/System.Linq.Queryable.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BE12B753-C130-4B68-86E3-877F1AEE52C0}</ProjectGuid>
<OutputType>Library</OutputType>
<AssemblyName>System.Linq.Queryable</AssemblyName>
<RootNamespace>System.Linq.Queryable</RootNamespace>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
</PropertyGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup>
<Compile Include="System\Linq\EnumerableExecutor.cs" />
<Compile Include="System\Linq\EnumerableQuery.cs" />
<Compile Include="System\Linq\EnumerableRewriter.cs" />
<Compile Include="System\Linq\Error.cs" />
<Compile Include="System\Linq\Expressions\OldExpressionVisitor.cs" />
<Compile Include="System\Linq\Expressions\ReadOnlyCollectionExtensions.cs" />
<Compile Include="System\Linq\Queryable.cs" />
<Compile Include="System\Linq\Strings.cs" />
<Compile Include="System\Linq\TypeHelper.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
50 changes: 50 additions & 0 deletions src/System.Linq.Queryable/src/System/Linq/EnumerableExecutor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Collections.Generic;
using System.Linq.Expressions;

namespace System.Linq
{
// Must remain public for Silverlight
public abstract class EnumerableExecutor
{
internal abstract object ExecuteBoxed();

internal static EnumerableExecutor Create(Expression expression)
{
Type execType = typeof(EnumerableExecutor<>).MakeGenericType(expression.Type);
return (EnumerableExecutor)Activator.CreateInstance(execType, new object[] { expression });
}
}

// Must remain public for Silverlight
public class EnumerableExecutor<T> : EnumerableExecutor
{
private Expression _expression;
private Func<T> _func;

// Must remain public for Silverlight
public EnumerableExecutor(Expression expression)
{
_expression = expression;
}

internal override object ExecuteBoxed()
{
return this.Execute();
}

internal T Execute()
{
if (_func == null)
{
EnumerableRewriter rewriter = new EnumerableRewriter();
Expression body = rewriter.Visit(_expression);
Expression<Func<T>> f = Expression.Lambda<Func<T>>(body, (IEnumerable<ParameterExpression>)null);
_func = f.Compile();
}
return _func();
}
}
}
Loading