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 class OldSchoolPerson { | |
| public string Name { get; set; } | |
| public int Age { get; set; } | |
| } | |
| public class ModernPerson { | |
| private string _name; | |
| private int _age; | |
| public ref string Name => ref _name; |
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; | |
| class ArgListFun { | |
| static void Main() { | |
| var arg2 = 1; | |
| string arg3; | |
| var arg1 = M(__arglist(123, ref arg2, out arg3)); | |
| Console.WriteLine(arg1); // 123 | |
| Console.WriteLine(arg2); // 43 |
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
| if (x == null) | |
| throw new ArgumentNullException(nameof(x)); | |
| return x; | |
| // => | |
| return x ?? throw new ArgumentNullException(nameof(x)); |
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
| [Pure, ContractAnnotation("null => null")] | |
| public static IArrowExpressionClause GetArrowExpressionClause([CanBeNull] this IExpressionBodyOwnerDeclaration declaration) | |
| { | |
| var functionDeclaration = declaration as ICSharpFunctionDeclaration; | |
| if (functionDeclaration != null) return functionDeclaration.ArrowExpression; | |
| var propertyDeclaration = declaration as IPropertyDeclaration; | |
| if (propertyDeclaration != null) return propertyDeclaration.ArrowExpression; | |
| var indexerDeclaration = declaration as IIndexerDeclaration; |
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
| foreach (var referenceExpression in codeBody.ThisAndDescendants<IReferenceExpression>()) | |
| { | |
| var resolveResult = referenceExpression.Reference.Resolve(); | |
| if (!resolveResult.ResolveErrorType.IsAcceptable) continue; | |
| var declaredElement = resolveResult.Result.DeclaredElement; | |
| var field = declaredElement as IField; | |
| if (field != null) | |
| { |
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
| IDeclaredElement declaredElement; | |
| PsiLanguageType language; | |
| Func<RenameIdentifierMarker, IDeclaredElementPointer<IDeclaredElement>> elementPointerFactory; | |
| Func<string> newNameGetter; | |
| IDeclaration declaration; | |
| var nameRange = GetNameRangeByChange(change, out declaredElement, out declaration, out language, | |
| out elementPointerFactory, out newNameGetter); | |
| /////////////////////////////////////////////////////////////////////////////////////////////////////// |
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 void CheckUnsafeContext([NotNull] IAwaitExpression awaitExpression, [NotNull] IHighlightingConsumer consumer) | |
| { | |
| for (var localFunctionDeclaration = awaitExpression.GetContainingNode<ILocalFunctionDeclaration>(); | |
| localFunctionDeclaration != null; | |
| localFunctionDeclaration = localFunctionDeclaration.GetContainingNode<ILocalFunctionDeclaration>()) | |
| { | |
| if (localFunctionDeclaration.IsUnsafe) | |
| { | |
| consumer.AddHighlighting(new CannotAwaitInUnsafeContextError(awaitExpression)); | |
| return; |
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
| protected override IRearrangeable CreateElement(IMultipleDeclarationMember member) | |
| { | |
| IMultipleDeclaration parent = null; | |
| string title = "declaration"; | |
| if (member is IFieldDeclaration) | |
| { | |
| parent = MultipleFieldDeclarationNavigator.GetByDeclarator((IFieldDeclaration)member); | |
| title = "field"; | |
| } |
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; | |
| public class C { | |
| public void M() { | |
| bool b; | |
| if (b = true) { } | |
| while (b = true) { } |
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 override string Text | |
| { | |
| get | |
| { | |
| if ((myValue == ConstantExpressionValue.TRUE && | |
| (ConditionalAndExpressionNavigator.GetByLeftOperand(myExpression) != null || | |
| ConditionalAndExpressionNavigator.GetByRightOperand(myExpression) != null)) | |
| || | |
| (myValue == ConstantExpressionValue.FALSE && | |
| (ConditionalOrExpressionNavigator.GetByRightOperand(myExpression) != null || |