333 references to Constructor
Microsoft.CodeAnalysis.CodeStyle (5)
AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
623case MethodKind.Constructor:
DeserializationConstructorCheck.cs (1)
26methodSymbol.MethodKind == MethodKind.Constructor &&
IParameterSymbolExtensions.cs (2)
30MethodKind: MethodKind.Constructor, 62MethodKind: MethodKind.Constructor,
ISymbolExtensions.cs (1)
223=> symbol is IMethodSymbol { MethodKind: MethodKind.Constructor };
Microsoft.CodeAnalysis.CodeStyle.Fixes (3)
AbstractAddParameterCodeFixProvider.cs (1)
128var isConstructorInitializer = candidates.All(m => m.MethodKind == MethodKind.Constructor);
CodeGenerationConstructorSymbol.cs (1)
39public override MethodKind MethodKind => MethodKind.Constructor;
CodeGenerationNamedTypeSymbol.cs (1)
174this.GetMembers().OfType<IMethodSymbol>().Where(m => m.MethodKind == MethodKind.Constructor && !m.IsStatic));
Microsoft.CodeAnalysis.CSharp (85)
Binder\Binder.ValueChecks.cs (4)
1217MethodKind desiredMethodKind = fieldIsStatic ? MethodKind.StaticConstructor : MethodKind.Constructor; 1679if (method.MethodKind == MethodKind.Constructor || method.IsInitOnly) 2261if (method.MethodKind == MethodKind.Constructor) 4798return (containingSymbol is MethodSymbol { MethodKind: MethodKind.Constructor } or FieldSymbol { IsStatic: false } or MethodSymbol { IsInitOnly: true }) &&
Binder\Binder_Crefs.cs (1)
780int signatureMemberArity = candidateMethodKind == MethodKind.Constructor
Binder\Binder_Expressions.cs (3)
1918(this.ContainingMember() is MethodSymbol { MethodKind: MethodKind.Constructor } containingMember && (object)containingMember != primaryCtor)) && // We are in a non-primary instance constructor 4115Debug.Assert(constructor.MethodKind == MethodKind.Constructor || 5599Debug.Assert(constructor.MethodKind == MethodKind.Constructor || constructor.MethodKind == MethodKind.StaticConstructor);
Binder\Binder_Statements.cs (2)
1788MethodKind.Constructor) || 3706if (constructor.MethodKind != MethodKind.Constructor || constructor.IsExtern)
BoundTree\BoundNodeExtensions.cs (1)
62return method.MethodKind == MethodKind.Constructor &&
CodeGen\EmitExpression.cs (1)
1966if (method.IsEffectivelyReadOnly && method.MethodKind != MethodKind.Constructor)
Compilation\CSharpCompilation.cs (1)
2811if (symbol.Kind == SymbolKind.Method && symbol.IsImplicitlyDeclared && ((MethodSymbol)symbol).MethodKind == MethodKind.Constructor)
Compilation\MethodBodySemanticModel.cs (1)
243if (MemberSymbol is MethodSymbol methodSymbol && methodSymbol.MethodKind == MethodKind.Constructor &&
Compiler\MethodCompiler.cs (3)
521(method.MethodKind == MethodKind.Constructor || method.IsScriptInitializer) ? processedInstanceInitializers : 1122if ((methodSymbol.MethodKind == MethodKind.Constructor || methodSymbol.MethodKind == MethodKind.StaticConstructor) && 2276if (method.MethodKind == MethodKind.Constructor && !method.IsExtern)
CSharpDeclarationComputer.cs (1)
109Debug.Assert(ctor.MethodKind == MethodKind.Constructor && typeDeclaration.ParameterList is object);
Emitter\Model\MethodSymbolAdapter.cs (2)
385return AdaptedMethodSymbol.MethodKind == MethodKind.Constructor; 634return this.MethodKind == MethodKind.Constructor
Emitter\Model\NamedTypeSymbolAdapter.cs (1)
621if ((alwaysIncludeConstructors && method.MethodKind == MethodKind.Constructor) || method.GetCciAdapter().ShouldInclude(context))
Emitter\NoPia\EmbeddedMethod.cs (1)
70return UnderlyingMethod.AdaptedMethodSymbol.MethodKind == MethodKind.Constructor;
FlowAnalysis\AbstractFlowPass.cs (1)
1334if (method is null || method.MethodKind != MethodKind.Constructor)
FlowAnalysis\DefiniteAssignment.cs (3)
103&& CurrentSymbol is MethodSymbol { MethodKind: MethodKind.Constructor, ContainingType.TypeKind: TypeKind.Struct }; 1214Debug.Assert(CurrentSymbol is MethodSymbol { MethodKind: MethodKind.Constructor, ContainingType.TypeKind: TypeKind.Struct }); 1261if (CurrentSymbol is not MethodSymbol { MethodKind: MethodKind.Constructor, ContainingType.TypeKind: TypeKind.Struct })
FlowAnalysis\FlowAnalysisPass.cs (1)
112Debug.Assert(method.MethodKind == MethodKind.Constructor);
FlowAnalysis\NullableWalker.cs (2)
433Debug.Assert(baseOrThisInitializer is null or { MethodKind: MethodKind.Constructor }); 1413return constructorBody is BoundConstructorMethodBody { Initializer: BoundExpressionStatement { Expression: BoundCall { Method: { MethodKind: MethodKind.Constructor } initializerMethod } } }
Lowering\ClosureConversion\ClosureConversion.cs (2)
185_seenBaseCall = method.MethodKind != MethodKind.Constructor; // only used for ctors 774if (_currentMethod.MethodKind == MethodKind.Constructor &&
Lowering\InitializerRewriter.cs (1)
22Debug.Assert((method.MethodKind == MethodKind.Constructor) || (method.MethodKind == MethodKind.StaticConstructor));
Lowering\LocalRewriter\LocalRewriter_Call.cs (1)
431var requiresInstanceReceiver = methodOrIndexer.RequiresInstanceReceiver() && methodOrIndexer is not MethodSymbol { MethodKind: MethodKind.Constructor } and not FunctionPointerMethodSymbol;
Lowering\LocalRewriter\LocalRewriter_Range.cs (1)
167case MethodKind.Constructor:
SymbolDisplay\SymbolDisplayVisitor.Members.cs (2)
327case MethodKind.Constructor: 469case MethodKind.Constructor:
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.ConstructorSymbol.cs (1)
45get { return MethodKind.Constructor; }
Symbols\Compilation_WellKnownMembers.cs (1)
259targetMethodKind = MethodKind.Constructor;
Symbols\ErrorMethodSymbol.cs (2)
206return MethodKind.Constructor; 283Debug.Assert(MethodKind == MethodKind.Constructor);
Symbols\MemberSymbolExtensions.cs (3)
362case MethodKind.Constructor: 375if ((object)method != null && method.MethodKind == MethodKind.Constructor) 440return method.MethodKind == MethodKind.Constructor && method.ParameterCount == 0;
Symbols\Metadata\PE\PEMethodSymbol.cs (4)
1152return MethodKind.Constructor; 1423var diag = PEUtilities.DeriveCompilerFeatureRequiredAttributeDiagnostic(this, containingModule, Handle, allowedFeatures: MethodKind == MethodKind.Constructor ? CompilerFeatureRequiredFeatures.RequiredMembers : CompilerFeatureRequiredFeatures.None, decoder); 1511Debug.Assert(MethodKind == MethodKind.Constructor); 1533var result = ObsoleteAttributeHelpers.GetObsoleteDataFromMetadata(_handle, (PEModuleSymbol)ContainingModule, ignoreByRefLikeMarker: false, ignoreRequiredMemberMarker: MethodKind == MethodKind.Constructor);
Symbols\Metadata\PE\PEParameterSymbol.cs (1)
868case "" when !ContainingSymbol.RequiresInstanceReceiver() || ContainingSymbol is MethodSymbol { MethodKind: MethodKind.Constructor or MethodKind.DelegateInvoke }:
Symbols\MethodSymbol.cs (6)
365protected bool IsValidReadOnlyTarget => !IsStatic && ContainingType.IsStructType() && MethodKind != MethodKind.Constructor && !IsInitOnly; 585internal bool HasSetsRequiredMembers => MethodKind == MethodKind.Constructor && HasSetsRequiredMembersImpl; 601case MethodKind.Constructor: 651return MethodKind == MethodKind.Constructor && ContainingType.IsScriptClass; 667return ((MethodKind == MethodKind.Constructor || MethodKind == MethodKind.StaticConstructor) && IsImplicitlyDeclared); 678return MethodKind == MethodKind.Constructor && IsImplicitlyDeclared;
Symbols\MethodSymbolExtensions.cs (1)
130case MethodKind.Constructor:
Symbols\NamedTypeSymbol.cs (1)
286Debug.Assert(method.MethodKind == MethodKind.Constructor);
Symbols\NativeIntegerTypeSymbol.cs (1)
113case MethodKind.Constructor:
Symbols\PublicModel\MethodSymbol.cs (2)
40case MethodKind.Constructor: 41return MethodKind.Constructor;
Symbols\Source\SourceComplexParameterSymbol.cs (1)
1336if (!ContainingSymbol.RequiresInstanceReceiver() || ContainingSymbol is MethodSymbol { MethodKind: MethodKind.Constructor or MethodKind.DelegateInvoke or MethodKind.LambdaMethod })
Symbols\Source\SourceConstructorSymbol.cs (3)
24var methodKind = syntax.Modifiers.Any(SyntaxKind.StaticKeyword) ? MethodKind.StaticConstructor : MethodKind.Constructor; 55if (methodKind == MethodKind.Constructor && syntax.Initializer != null) 155else if (ContainingType.IsStatic && methodKind == MethodKind.Constructor)
Symbols\Source\SourceDelegateMethodSymbol.cs (1)
222: base(delegateType, voidType, syntax, MethodKind.Constructor, DeclarationModifiers.Public)
Symbols\Source\SourceMemberContainerSymbol.cs (8)
2045if (method1.MethodKind == MethodKind.Constructor && 2061var methodKind = method1.MethodKind == MethodKind.Constructor ? MessageID.IDS_SK_CONSTRUCTOR : MessageID.IDS_SK_METHOD; 3793case MethodKind.Constructor: 3839if (m.MethodKind == MethodKind.Constructor && m.ParameterCount == 0) 3881if (hasInitializers && !builder.NonTypeMembers.Any(member => member is MethodSymbol { MethodKind: MethodKind.Constructor })) 3933case MethodSymbol { MethodKind: not (MethodKind.Ordinary or MethodKind.Constructor) }: 4070MethodKind.Constructor, 4535case MethodKind.Constructor:
Symbols\Source\SourceMethodSymbolWithAttributes.cs (5)
147case MethodKind.Constructor: 1034case MethodKind.Constructor: 1062var errorCode = (this.MethodKind == MethodKind.Constructor || this.MethodKind == MethodKind.StaticConstructor) ? 1218case MethodKind.Constructor: 1298if (this.ContainingType.IsComImport && this.MethodKind == MethodKind.Constructor)
Symbols\Source\SourceNamedTypeSymbol.cs (1)
1687|| GetMembers().All(m => m is not MethodSymbol { MethodKind: MethodKind.Constructor, ObsoleteKind: ObsoleteAttributeKind.None } method
Symbols\Source\ThisParameterSymbol.cs (1)
44if (_containingMethod?.MethodKind == MethodKind.Constructor)
Symbols\Symbol_Attributes.cs (1)
58case MethodKind.Constructor:
Symbols\SymbolExtensions.cs (1)
846=> method is { MethodKind: MethodKind.Constructor, HasSetsRequiredMembers: false };
Symbols\Synthesized\Records\SynthesizedPrimaryConstructor.cs (1)
26MethodKind.Constructor,
Symbols\Synthesized\Records\SynthesizedRecordCopyCtor.cs (1)
120if (member is MethodSymbol { ContainingType.IsRecordStruct: false, MethodKind: MethodKind.Constructor } method)
Symbols\Synthesized\SynthesizedInstanceConstructor.cs (1)
190get { return MethodKind.Constructor; }
Symbols\TypeMap.cs (1)
194stopAt?.MethodKind == MethodKind.Constructor);
Microsoft.CodeAnalysis.CSharp.CodeStyle (1)
CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs (1)
81if (context.OwningSymbol is IMethodSymbol { MethodKind: MethodKind.Constructor })
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (2)
Emit\CompilationEmitTests.cs (1)
2732var cciMethods = class1TypeDef.GetMethods(context).Where(m => ((MethodSymbol)m.GetInternalSymbol()).MethodKind != MethodKind.Constructor);
Emit\EmitMetadataTests.cs (1)
602Assert.Equal(MethodKind.Constructor, ctor.MethodKind);
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (2)
Attributes\AttributeTests_CallerInfoAttributes.cs (2)
4392Assert.Equal(MethodKind.Constructor, ctor.MethodKind); 4422Assert.Equal(MethodKind.Constructor, ctor.MethodKind);
Microsoft.CodeAnalysis.CSharp.Features (4)
CSharpDeclarationComputer.cs (1)
109Debug.Assert(ctor.MethodKind == MethodKind.Constructor && typeDeclaration.ParameterList is object);
CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs (1)
81if (context.OwningSymbol is IMethodSymbol { MethodKind: MethodKind.Constructor })
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (2)
195return (member as IMethodSymbol)?.MethodKind == MethodKind.Constructor; 3103if (container is IMethodSymbol { IsImplicitlyDeclared: false, MethodKind: MethodKind.Constructor })
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (5)
Semantics\LocalFunctionTests.cs (1)
1063Assert.Equal(MethodKind.Constructor, attrConstructor.MethodKind);
Semantics\NativeIntegerTests.cs (2)
345return !(nativeIntegerMember is IMethodSymbol { MethodKind: MethodKind.Constructor }); 459return !(nativeIntegerMember is MethodSymbol { MethodKind: MethodKind.Constructor });
Semantics\PrimaryConstructorTests.cs (2)
134Assert.Equal(MethodKind.Constructor, members.Cast<MethodSymbol>().Single().MethodKind); 713Assert.All(c.GetMembers(), m => Assert.True(m is MethodSymbol { MethodKind: MethodKind.Constructor }));
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (96)
Compilation\GetSemanticInfoTests.cs (3)
1074Assert.Equal(MethodKind.Constructor, ((IMethodSymbol)baseConstructor).MethodKind); 1093Assert.Equal(MethodKind.Constructor, ((IMethodSymbol)baseConstructor).MethodKind); 1116Assert.Equal(MethodKind.Constructor, invokedConstructor.MethodKind);
Compilation\SemanticModelAPITests.cs (3)
1371Assert.Equal(MethodKind.Constructor, method.MethodKind); 2087Assert.Equal(MethodKind.Constructor, method.MethodKind); 2104Assert.Equal(MethodKind.Constructor, method.MethodKind);
Compilation\SemanticModelGetSemanticInfoTests.cs (4)
4886Assert.Equal(MethodKind.Constructor, ((IMethodSymbol)semanticInfo.Symbol.ContainingSymbol).MethodKind); 4893Assert.Equal(MethodKind.Constructor, ((IMethodSymbol)semanticInfo.Symbol.ContainingSymbol).MethodKind); 6373Assert.Equal(MethodKind.Constructor, ((IMethodSymbol)symbol).MethodKind); 7295Assert.Equal(MethodKind.Constructor, ((IMethodSymbol)semanticInfo.Symbol).MethodKind);
DocumentationComments\CrefTests.cs (1)
3326Assert.Equal(MethodKind.Constructor, ((IMethodSymbol)info.CandidateSymbols[0]).MethodKind);
Symbols\AccessorOverriddenOrHiddenMembersTests.cs (1)
883if (m.MethodKind == MethodKind.Constructor)
Symbols\CheckedUserDefinedOperatorsTests.cs (68)
51var opSymbol = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).First(); 84var opSymbols = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).ToArray(); 118var opSymbols = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).ToArray(); 165var opSymbols = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).ToArray(); 356var opSymbol = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 381var opSymbol = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 457var opSymbol = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 484var opSymbol = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 515var expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).First(); 533expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).First(); 541expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).First(); 687var expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 705expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 713expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 810var expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 818expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 826expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 859var expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 867expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 875expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 904var opSymbol = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 938var opSymbols = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).ToArray(); 981var opSymbols = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).ToArray(); 1017var opSymbols = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).ToArray(); 1268var opSymbol = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).First(); 1302var opSymbols = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).ToArray(); 1337var opSymbols = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).ToArray(); 1371var opSymbols = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).ToArray(); 1526var opSymbol = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 1553var opSymbol = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 1635var opSymbol = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 1662var opSymbol = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 1695var expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).First(); 1714expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).First(); 1722expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).First(); 1818var expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 1836expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 1851expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 1884var expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 1892expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 1900expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 1928var expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 1946expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 1954expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 2053var expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 2071expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 2079expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 2112var expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 2120expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 2128expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 2181var opSymbol = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 2226var opSymbols = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).ToArray(); 2441var opSymbol = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 2468var opSymbol = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 2502var opSymbol = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).First(); 2538var opSymbols = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).ToArray(); 2578var opSymbols = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).ToArray(); 2617var opSymbols = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).ToArray(); 2758var opSymbol = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 2781var opSymbol = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 2854var expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).First(); 2872expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).First(); 2880expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).First(); 3020var expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 3038expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 3046expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 3188var opSymbol = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 3220var opSymbols = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).ToArray();
Symbols\Metadata\MetadataMemberTests.cs (1)
164Assert.Equal(MethodKind.Constructor, ctor.MethodKind);
Symbols\Metadata\PE\LoadingMethods.cs (1)
1182Assert.Equal(m.Name == ".cctor" ? MethodKind.StaticConstructor : MethodKind.Constructor, ((MethodSymbol)m).MethodKind);
Symbols\RequiredMembersTests.cs (1)
86foreach (var ctor in type.GetMembers().Where(m => m is MethodSymbol { MethodKind: MethodKind.Constructor }))
Symbols\Source\DeclaringSyntaxNodeTests.cs (1)
523if (memb.Kind == SymbolKind.Method && ((IMethodSymbol)memb).MethodKind == MethodKind.Constructor)
Symbols\Source\MethodTests.cs (1)
120Assert.Equal(MethodKind.Constructor, m.MethodKind);
Symbols\StaticAbstractMembersInInterfacesTests.cs (4)
32215var opSymbol = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 32252var opSymbols = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).ToArray(); 32463var opSymbol = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single(); 32650var opSymbol = c.GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).Single();
Symbols\TypeTests.cs (1)
1204.Count(m => !(m is MethodSymbol) || (m as MethodSymbol).MethodKind != MethodKind.Constructor));
Symbols\UnsignedRightShiftTests.cs (6)
2706var expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).First(); 2724expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).First(); 2732expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).First(); 2878var expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).First(); 2896expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).First(); 2904expectedSymbol = compilation.SourceModule.GlobalNamespace.GetTypeMember("C").GetMembers().OfType<MethodSymbol>().Where(m => m.MethodKind != MethodKind.Constructor).First();
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
Classification\SyntaxClassification\NameSyntaxClassifier.cs (1)
288if (methodSymbol.MethodKind == MethodKind.Constructor)
Microsoft.CodeAnalysis.Features (12)
AbstractAddParameterCodeFixProvider.cs (1)
128var isConstructorInitializer = candidates.All(m => m.MethodKind == MethodKind.Constructor);
AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (1)
623case MethodKind.Constructor:
CodeLens\CodeLensFindReferenceProgress.cs (1)
134(definition as IMethodSymbol)?.MethodKind == MethodKind.Constructor;
DeserializationConstructorCheck.cs (1)
26methodSymbol.MethodKind == MethodKind.Constructor &&
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (3)
362MethodKind.Constructor => FeaturesResources.constructor, 3455MethodKind.Constructor or 4939Contract.ThrowIfFalse(oldCtor is IMethodSymbol { MethodKind: MethodKind.Constructor or MethodKind.StaticConstructor });
GoToBase\AbstractGoToBaseService.cs (1)
47if (bases.Length == 0 && symbol is IMethodSymbol { MethodKind: MethodKind.Constructor } constructor)
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (1)
70if (method.MethodKind != MethodKind.Constructor)
IntroduceParameter\AbstractIntroduceParameterCodeRefactoringProvider.cs (2)
82if (methodKind is not (MethodKind.Ordinary or MethodKind.LocalFunction or MethodKind.Constructor)) 156if (methodSymbol.MethodKind is not MethodKind.Constructor)
RQName\RQNodeBuilder.cs (1)
212if (symbol.MethodKind == MethodKind.Constructor)
Microsoft.CodeAnalysis.Test.Utilities (2)
Diagnostics\FieldCouldBeReadOnlyAnalyzer.cs (1)
48bool inConstructor = containingMethod.MethodKind == MethodKind.Constructor;
Diagnostics\TrackingDiagnosticAnalyzer.cs (1)
119new { SymbolKind = SymbolKind.Method, MethodKind = MethodKind.Constructor, ReturnsVoid = true },
Microsoft.CodeAnalysis.VisualBasic (55)
Analysis\FlowAnalysis\AbstractFlowPass.vb (2)
1210Debug.Assert(method.Kind <> MethodKind.Constructor) 1281Debug.Assert(method.Kind <> MethodKind.Constructor)
Analysis\InitializerRewriter.vb (1)
273If methodSymbol.MethodKind = MethodKind.Constructor Then
Binding\Binder_Expressions.vb (2)
1849If containingMethodKind = MethodKind.Constructor Then 1891Return MethodKind.Constructor
Binding\Binder_Invocation.vb (2)
58If Me.ContainingMember.Kind = SymbolKind.Method AndAlso DirectCast(Me.ContainingMember, MethodSymbol).MethodKind = MethodKind.Constructor Then 716Return methodGroup.Methods(0).MethodKind = MethodKind.Constructor
Binding\Binder_Lambda.vb (1)
730Case MethodKind.SharedConstructor, MethodKind.Constructor
Binding\Binder_Lookup.vb (1)
1963containingMethod.MethodKind = MethodKind.Constructor AndAlso
Binding\Binder_Statements.vb (1)
347If methodSymbol.MethodKind = MethodKind.Constructor Then
Binding\Binder_Utils.vb (1)
1645MethodKindConstructor = CUInt(MethodKind.Constructor) << MethodKindShift
CodeGen\EmitAddress.vb (1)
281Return Me._method.MethodKind = MethodKind.Constructor AndAlso
Compilation\MethodCompiler.vb (7)
138DirectCast(symbol, MethodSymbol).MethodKind = MethodKind.Constructor Then 687ElseIf method.MethodKind = MethodKind.Constructor OrElse method.IsScriptInitializer Then 761sourceMethod.MethodKind = MethodKind.Constructor AndAlso 1455If method.MethodKind = MethodKind.Constructor OrElse method.MethodKind = MethodKind.SharedConstructor Then 1781If method.MethodKind = MethodKind.Constructor Then 1798If referencedMethod IsNot Nothing AndAlso referencedMethod.MethodKind = MethodKind.Constructor Then 1858Debug.Assert(constructor.MethodKind = MethodKind.Constructor)
Compilation\SemanticModel.vb (1)
1863(result.Kind = SymbolKind.Method AndAlso DirectCast(result, MethodSymbol).MethodKind = MethodKind.Constructor) Then
Emit\MethodSymbolAdapter.vb (2)
298Return AdaptedMethodSymbol.MethodKind = MethodKind.Constructor 529Dim result = Me.MethodKind = MethodKind.Constructor OrElse
Emit\NoPia\EmbeddedMethod.vb (1)
55Return UnderlyingMethod.AdaptedMethodSymbol.MethodKind = MethodKind.Constructor
Lowering\LambdaRewriter\LambdaFrameConstructor.vb (1)
25Return MethodKind.Constructor
Lowering\LambdaRewriter\LambdaRewriter.vb (2)
543If _innermostFramePointer.Kind = SymbolKind.Parameter AndAlso _topLevelMethod.MethodKind = MethodKind.Constructor AndAlso 1371If node.Method.MethodKind = MethodKind.Constructor AndAlso receiver IsNot Nothing AndAlso receiver.IsInstanceReference Then
Lowering\LocalRewriter\LocalRewriter_Conversion.vb (2)
1064If memberSymbol.MethodKind = MethodKind.Constructor Then 1203If memberSymbol.MethodKind = MethodKind.Constructor Then
Semantics\OverloadResolution.vb (1)
3395DirectCast(candidate.Candidate.UnderlyingSymbol, MethodSymbol).MethodKind = MethodKind.Constructor AndAlso
SymbolDisplay\SymbolDisplayVisitor.Members.vb (3)
197Case MethodKind.Constructor, MethodKind.StaticConstructor 338Case MethodKind.Constructor, MethodKind.StaticConstructor 436Case MethodKind.Constructor,
Symbols\EmbeddedSymbols\EmbeddedSymbolManager.SymbolsCollection.vb (3)
240MethodKind.Constructor, 289MethodKind.Constructor 372Debug.Assert(kind = MethodKind.Constructor OrElse
Symbols\Metadata\PE\PEMethodSymbol.vb (3)
369Return MethodKind.Constructor 400Return _packedFlags.MethodKind = MethodKind.Constructor AndAlso ParameterCount = 0 415_packedFlags.MethodKind = MethodKind.Constructor
Symbols\MethodSymbol.vb (2)
31Return Me.ParameterCount = 0 AndAlso Me.MethodKind = MethodKind.Constructor 449Return Me.MethodKind = MethodKind.Constructor AndAlso Me.ContainingType.IsScriptClass
Symbols\NamedTypeSymbol.vb (1)
413Debug.Assert(method.MethodKind = MethodKind.Constructor)
Symbols\PropertySymbol.vb (1)
174If If(TryCast(containingMember, MethodSymbol)?.MethodKind <> MethodKind.Constructor, True) Then
Symbols\Source\OverrideHidingHelper.vb (1)
497Case MethodKind.LambdaMethod, MethodKind.Constructor, MethodKind.SharedConstructor
Symbols\Source\SourceDelegateMethodSymbol.vb (1)
198Return Me.MethodKind = MethodKind.Constructor
Symbols\Source\SourceMemberContainerTypeSymbol.vb (2)
2767(DirectCast(sym, MethodSymbol).MethodKind = MethodKind.Constructor OrElse 2772If method.MethodKind = MethodKind.Constructor AndAlso method.ParameterCount = 0 Then
Symbols\Source\SourceMethodSymbol.vb (2)
1958Case MethodKind.Constructor, 2243Case MethodKind.Constructor,
Symbols\Source\SourceNamedTypeSymbol.vb (2)
2640If method.MethodKind = MethodKind.Constructor AndAlso method.ParameterCount = 0 Then 2649If method.MethodKind = MethodKind.Constructor AndAlso method.CanBeCalledWithNoParameters() Then
Symbols\Symbol_Attributes.vb (1)
74Case MethodKind.Constructor,
Symbols\SymbolExtensions.vb (1)
263Return kind = MethodKind.Constructor OrElse kind = MethodKind.SharedConstructor
Symbols\SynthesizedSymbols\SynthesizedConstructorBase.vb (1)
192Return If(m_isShared, MethodKind.SharedConstructor, MethodKind.Constructor)
Symbols\SynthesizedSymbols\SynthesizedDelegateMethodSymbol.vb (1)
415Return Me.MethodKind = MethodKind.Constructor
Symbols\WellKnownMembers.vb (1)
435targetMethodKind = MethodKind.Constructor
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (1)
Emit\EmitMetadata.vb (1)
785Assert.Equal(MethodKind.Constructor, ctor.MethodKind)
Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator.ExpressionCompiler.UnitTests (1)
HoistedMeTests.vb (1)
1120CheckLambdaOverloading(source, Function(m) m.MethodKind = MethodKind.Constructor)
Microsoft.CodeAnalysis.VisualBasic.Features (1)
GenerateConstructor\VisualBasicGenerateConstructorService.vb (1)
184Return If(methodSymbol IsNot Nothing AndAlso methodSymbol.MethodKind = MethodKind.Constructor, methodSymbol, Nothing)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (6)
DeclaringSyntaxNodeTests.vb (1)
514If memb.Kind = SymbolKind.Method AndAlso (DirectCast(memb, MethodSymbol)).MethodKind = MethodKind.Constructor Then
Semantics\GetExtendedSemanticInfoTests.vb (4)
4359Assert.Equal(MethodKind.Constructor, method.MethodKind) 4398Assert.Equal(MethodKind.Constructor, method.MethodKind) 4434Assert.Equal(MethodKind.Constructor, method.MethodKind) 4473Assert.Equal(MethodKind.Constructor, method.MethodKind)
Semantics\UsingStatementTest.vb (1)
345If (DirectCast(type.Symbol, MethodSymbol).MethodKind = MethodKind.Constructor) Then
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (18)
SymbolsTests\AnonymousDelegates\AnonymousDelegates_CreationAndEmit.vb (1)
306Assert.Equal(MethodKind.Constructor, x16.GetMethod(".ctor").MethodKind)
SymbolsTests\CheckedUserDefinedOperatorsTests.vb (9)
179If m.MethodKind <> MethodKind.Constructor Then 188Dim operators = c0_3.GetMembers().OfType(Of IMethodSymbol)().Where(Function(m) m.MethodKind <> MethodKind.Constructor).ToArray() 254If m.MethodKind <> MethodKind.Constructor Then 366If m.MethodKind <> MethodKind.Constructor Then 375Dim operators = c0_3.GetMembers().OfType(Of IMethodSymbol)().Where(Function(m) m.MethodKind <> MethodKind.Constructor).ToArray() 437If m.MethodKind <> MethodKind.Constructor Then 545If m.MethodKind <> MethodKind.Constructor Then 554Dim operators = c0_3.GetMembers().OfType(Of IMethodSymbol)().Where(Function(m) m.MethodKind <> MethodKind.Constructor).ToArray() 612If m.MethodKind <> MethodKind.Constructor Then
SymbolsTests\Metadata\MetadataMemberTests.vb (2)
168Assert.Equal(MethodKind.Constructor, ctor.MethodKind) 732If m.MethodKind = MethodKind.Constructor Then
SymbolsTests\Metadata\PE\LoadingMethods.vb (1)
772Assert.Equal(If(m.Name = ".cctor", MethodKind.SharedConstructor, MethodKind.Constructor), DirectCast(m, MethodSymbol).MethodKind)
SymbolsTests\Source\MethodTests.vb (5)
66Assert.Equal(MethodKind.Constructor, ctor.MethodKind) 242Assert.Equal(MethodKind.Constructor, m1.MethodKind) 261Assert.Equal(MethodKind.Constructor, m2.MethodKind) 388Assert.Equal(MethodKind.Constructor, m1.MethodKind) 413Assert.Equal(MethodKind.Constructor, m2.MethodKind)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (3)
CaseCorrection\VisualBasicCaseCorrectionService.Rewriter.vb (1)
169(symbol.IsKind(SymbolKind.Method) AndAlso DirectCast(symbol, IMethodSymbol).MethodKind = MethodKind.Constructor)
Classification\SyntaxClassification\NameSyntaxClassifier.vb (1)
212Case MethodKind.Constructor
Recommendations\VisualBasicRecommendationServiceRunner.vb (1)
376If method IsNot Nothing AndAlso method.MethodKind = MethodKind.Constructor Then
Microsoft.CodeAnalysis.Workspaces (13)
CodeGenerationConstructorSymbol.cs (1)
39public override MethodKind MethodKind => MethodKind.Constructor;
CodeGenerationNamedTypeSymbol.cs (1)
174this.GetMembers().OfType<IMethodSymbol>().Where(m => m.MethodKind == MethodKind.Constructor && !m.IsStatic));
Editing\SyntaxGenerator.cs (2)
748case MethodKind.Constructor: 845case MethodKind.Constructor:
FindSymbols\FindReferences\Finders\ConstructorInitializerSymbolReferenceFinder.cs (1)
20=> symbol.MethodKind == MethodKind.Constructor;
FindSymbols\FindReferences\Finders\ConstructorSymbolReferenceFinder.cs (2)
27=> symbol.MethodKind is MethodKind.Constructor or MethodKind.StaticConstructor; 66result.AddRange(symbol.MethodKind == MethodKind.Constructor
IParameterSymbolExtensions.cs (2)
30MethodKind: MethodKind.Constructor, 62MethodKind: MethodKind.Constructor,
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs\ISymbolExtensions.cs (1)
223=> symbol is IMethodSymbol { MethodKind: MethodKind.Constructor };
Rename\RenameUtilities.cs (1)
361if (methodSymbol.MethodKind is MethodKind.Constructor or
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (1)
196if (!method.IsImplicitlyDeclared && (method.MethodKind == MethodKind.Constructor ||
Shared\Extensions\ISymbolExtensions.cs (1)
478if (methodSymbol.MethodKind is MethodKind.Constructor or MethodKind.StaticConstructor)
Microsoft.CodeAnalysis.Workspaces.UnitTests (2)
UtilityTest\DocumentationCommentIdTests.cs (2)
156CheckDeclarationId<IMethodSymbol>("M:Acme.Widget.#ctor", compilation, s => s.MethodKind == MethodKind.Constructor && s.Parameters.Length == 0); 157CheckDeclarationId<IMethodSymbol>("M:Acme.Widget.#ctor(System.String)", compilation, s => s.MethodKind == MethodKind.Constructor && s.Parameters.Length == 1);
Microsoft.VisualStudio.LanguageServices (5)
Implementation\VsRefactorNotifyService.cs (1)
165if (methodSymbol.MethodKind is MethodKind.Constructor or
Library\ObjectBrowser\AbstractListItemFactory.cs (1)
349methodSymbol.MethodKind == MethodKind.Constructor ||
Progression\GraphBuilder.cs (2)
372if (methodSymbol.MethodKind == MethodKind.Constructor) 517case MethodKind.Constructor:
Progression\GraphQueries\CallsGraphQuery.cs (1)
56(newSymbol.CanBeReferencedByName || ((IMethodSymbol)newSymbol).MethodKind == MethodKind.Constructor))
Microsoft.VisualStudio.LanguageServices.CSharp (2)
CodeModel\CSharpCodeModelService.cs (1)
2198case MethodKind.Constructor:
ObjectBrowser\DescriptionBuilder.cs (1)
194if (methodSymbol.MethodKind is not MethodKind.Constructor and
Microsoft.VisualStudio.LanguageServices.Implementation (5)
CodeModel\Collections\ExternalOverloadsCollection.cs (1)
54not MethodKind.Constructor)
CodeModel\Collections\OverloadsCollection.cs (1)
56not MethodKind.Constructor)
CodeModel\ExternalElements\ExternalCodeFunction.cs (2)
51case MethodKind.Constructor: 74not MethodKind.Constructor)
CodeModel\InternalElements\CodeFunction.cs (1)
123not MethodKind.Constructor)
Microsoft.VisualStudio.LanguageServices.UnitTests (2)
CommonControls\NewTypeDestinationSelectionViewModelTests.vb (1)
238Dim extractableMembers = DirectCast(symbol, INamedTypeSymbol).GetMembers().Where(Function(s) Not (TypeOf s Is IMethodSymbol) OrElse DirectCast(s, IMethodSymbol).MethodKind <> MethodKind.Constructor)
ExtractInterface\ExtractInterfaceViewModelTests.vb (1)
301Dim extractableMembers = DirectCast(symbol, INamedTypeSymbol).GetMembers().Where(Function(s) Not (TypeOf s Is IMethodSymbol) OrElse DirectCast(s, IMethodSymbol).MethodKind <> MethodKind.Constructor)
Microsoft.VisualStudio.LanguageServices.VisualBasic (1)
CodeModel\VisualBasicCodeModelService.vb (1)
2548Case MethodKind.Constructor,