Welcome to mirror list, hosted at ThFree Co, Russian Federation.

SampleClassWithProperties.cs « IndexExpression « tests « System.Linq.Expressions « src - github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a75fdc5a054370544dd446578fc0e8b68f646147 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Collections.Generic;
using System.Reflection;

namespace System.Linq.Expressions.Tests
{
    internal class SampleClassWithProperties
    {
        internal readonly PropertyInfo DefaultIndexer = typeof(List<int>).GetProperty("Item");
        internal readonly ConstantExpression[] DefaultArguments = { Expression.Constant(0) };

        internal MemberExpression DefaultPropertyExpression => Expression.Property(Expression.Constant(this),
            typeof(SampleClassWithProperties).GetProperty(nameof(DefaultProperty)));

        internal IndexExpression DefaultIndexExpression => Expression.MakeIndex(
            DefaultPropertyExpression,
            DefaultIndexer,
            DefaultArguments);

        public List<int> DefaultProperty { get; set; }

        public List<int> AlternativeProperty { get; set; }
    }
}