Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c4b23e4
Image updates.
damabe Feb 27, 2019
a9fd7be
Image updates.
damabe Feb 27, 2019
648a692
Merge branch 'master' of https://github.com/dotnet/docs
damabe Mar 6, 2019
ad6b189
Merge branch 'master' of https://github.com/dotnet/docs
damabe Mar 7, 2019
3b1be9a
Merge branch 'master' of https://github.com/dotnet/docs
damabe Mar 8, 2019
970c319
Merge branch 'master' of https://github.com/dotnet/docs
damabe Mar 10, 2019
1531b8d
Merge branch 'master' of https://github.com/dotnet/docs
damabe Mar 13, 2019
3ba1a22
Merge branch 'master' of https://github.com/dotnet/docs
damabe Mar 15, 2019
f170c87
Merge branch 'master' of https://github.com/dotnet/docs
damabe Mar 16, 2019
37c98b1
Merge branch 'master' of https://github.com/dotnet/docs
damabe Mar 17, 2019
18da5b4
Merge branch 'master' of https://github.com/dotnet/docs
damabe Mar 18, 2019
1fca543
Merge branch 'master' of https://github.com/dotnet/docs
damabe Mar 19, 2019
ac379a9
Merge branch 'master' of https://github.com/dotnet/docs
damabe Mar 20, 2019
a3edb9a
Merge branch 'master' of https://github.com/dotnet/docs
damabe Mar 20, 2019
d9d1c45
Merge branch 'master' of https://github.com/dotnet/docs
damabe Mar 20, 2019
b8cb6ed
Merge branch 'master' of https://github.com/dotnet/docs
damabe Mar 22, 2019
24bb478
Merge branch 'master' of https://github.com/dotnet/docs
damabe Mar 23, 2019
c014f20
SEO image updates.
damabe Mar 23, 2019
5a6643a
SEO image updates.
damabe Mar 23, 2019
560ddaa
SEO image updates.
damabe Mar 23, 2019
7859762
SEO image updates.
damabe Mar 24, 2019
d77b4de
SEO image updates.
damabe Mar 24, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,9 @@ ms.assetid: 839c960c-c2dc-4d05-af4d-ca5428e54008

`anExample.ExampleMethod(3, optionalint: 4);`

IntelliSense uses brackets to indicate optional parameters, as shown in the following illustration.
IntelliSense uses brackets to indicate optional parameters, as shown in the following illustration:

![IntelliSense Quick Info for method ExampleMethod.](../../../csharp/programming-guide/classes-and-structs/media/optional_parameters.png "Optional_Parameters")
Optional parameters in ExampleMethod
![Screenshot showing IntelliSense quick info for the ExampleMethod method.](./media/named-and-optional-arguments/optional-examplemethod-parameters.png)

> [!NOTE]
> You can also declare optional parameters by using the .NET <xref:System.Runtime.InteropServices.OptionalAttribute> class. `OptionalAttribute` parameters do not require a default value.
Expand All @@ -96,10 +95,9 @@ Optional parameters in ExampleMethod
## COM Interfaces
Named and optional arguments, along with support for dynamic objects and other enhancements, greatly improve interoperability with COM APIs, such as Office Automation APIs.

For example, the <xref:Microsoft.Office.Interop.Excel.Range.AutoFormat%2A> method in the Microsoft Office Excel <xref:Microsoft.Office.Interop.Excel.Range> interface has seven parameters, all of which are optional. These parameters are shown in the following illustration.
For example, the <xref:Microsoft.Office.Interop.Excel.Range.AutoFormat%2A> method in the Microsoft Office Excel <xref:Microsoft.Office.Interop.Excel.Range> interface has seven parameters, all of which are optional. These parameters are shown in the following illustration:

![IntelliSense Quick Info for the AutoFormat method.](../../../csharp/programming-guide/classes-and-structs/media/autoformat_parameters.png "AutoFormat_Parameters")
AutoFormat parameters
![Screenshot showing IntelliSense quick info for the AutoFormat method.](./media/named-and-optional-arguments/autoformat-method-parameters.png)

In C# 3.0 and earlier versions, an argument is required for each parameter, as shown in the following example.

Expand Down
15 changes: 9 additions & 6 deletions docs/framework/interop/runtime-callable-wrapper.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ ms.author: "ronpet"
The common language runtime exposes COM objects through a proxy called the runtime callable wrapper (RCW). Although the RCW appears to be an ordinary object to .NET clients, its primary function is to marshal calls between a .NET client and a COM object.

The runtime creates exactly one RCW for each COM object, regardless of the number of references that exist on that object. The runtime maintains a single RCW per process for each object. If you create an RCW in one application domain or apartment, and then pass a reference to another application domain or apartment, a proxy to the first object will be used. As the following illustration shows, any number of managed clients can hold a reference to the COM objects that expose INew and INewer interfaces.

![RCW](./media/rcw.gif "rcw")
Accessing COM objects through the runtime callable wrapper

The following image shows the process for accessing COM objects through the runtime callable wrapper:

![Process for accessing COM objects throug the RCW.](./media/runtime-callable-wrapper/runtime-callable-wrapper.gif)


Using metadata derived from a type library, the runtime creates both the COM object being called and a wrapper for that object. Each RCW maintains a cache of interface pointers on the COM object it wraps and releases its reference on the COM object when the RCW is no longer needed. The runtime performs garbage collection on the RCW.

Expand All @@ -26,10 +28,11 @@ Accessing COM objects through the runtime callable wrapper
The standard wrapper enforces built-in marshaling rules. For example, when a .NET client passes a String type as part of an argument to an unmanaged object, the wrapper converts the string to a BSTR type. Should the COM object return a BSTR to its managed caller, the caller receives a String. Both the client and the server send and receive data that is familiar to them. Other types require no conversion. For instance, a standard wrapper will always pass a 4-byte integer between managed and unmanaged code without converting the type.

## Marshaling selected interfaces
The primary goal of the [runtime callable wrapper](runtime-callable-wrapper.md) (RCW) is to hide the differences between the managed and unmanaged programming models. To create a seamless transition, the RCW consumes selected COM interfaces without exposing them to the .NET client, as shown in the following illustration.
The primary goal of the [runtime callable wrapper](runtime-callable-wrapper.md) (RCW) is to hide the differences between the managed and unmanaged programming models. To create a seamless transition, the RCW consumes selected COM interfaces without exposing them to the .NET client, as shown in the following illustration.

The following image shows COM interfaces and the runtime callable wrapper:

![RCW With Interfaces](./media/rcwwithinterfaces.gif "rcwwithinterfaces")
COM interfaces and the runtime callable wrapper
![Screenshot of the runtime callable wrapper with interfaces.](./media/runtime-callable-wrapper/runtime-callable-wrapper-interfaces.gif)

When created as an early-bound object, the RCW is a specific type. It implements the interfaces that the COM object implements and exposes the methods, properties, and events from the object's interfaces. In the illustration, the RCW exposes the INew interface but consumes the **IUnknown** and **IDispatch** interfaces. Further, the RCW exposes all members of the INew interface to the .NET client.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ graphics.DrawEllipse(pen, 0, 0, 100, 50);

The following illustration shows the two ellipses. Note that the 30-degree rotation is about the origin of the coordinate system (upper-left corner of the client area), not about the centers of the ellipses. Also note that the pen width of 1 means 1 pixel for the first ellipse and 1 millimeter for the second ellipse.

![Ovals](./media/csgraphicsascon1.png "csgraphicsascon1")
![Illustration that shows two ellipses: rotation and pen width.](./media/managing-the-state-of-a-graphics-object/set-rotation-pen-width-drawellipse-method.png)

### Clipping Region
A <xref:System.Drawing.Graphics> object maintains a clipping region that applies to all items drawn by that <xref:System.Drawing.Graphics> object. You can set the clipping region by calling the <xref:System.Drawing.Graphics.SetClip%2A> method.
Expand Down Expand Up @@ -140,9 +140,9 @@ graphics.DrawLine(pen, 0, 30, 150, 160);
graphics.DrawLine(pen, 40, 20, 190, 150);
```

The following illustration shows the clipped lines.
The following illustration shows the clipped lines:

![Limited Clip Region](./media/graphicsascon2.png "graphicsascon2")
![Diagram that shows the limited clip region.](./media/managing-the-state-of-a-graphics-object/set-clipping-region-setclip-method.png)

## See also
- [Graphics and Drawing in Windows Forms](graphics-and-drawing-in-windows-forms.md)
Expand Down
4 changes: 2 additions & 2 deletions docs/framework/wpf/security-wpf.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ms.assetid: ee1baea0-3611-4e36-9ad6-fcd5205376fb

*Application navigation* is navigation between items of content within an application that is hosted by a browser. *Browser navigation* is navigation that changes the content and location URL of a browser itself. The relationship between application navigation (typically XAML) and browser navigation (typically HTML) is shown in the following illustration:

![Navigation diagram](./media/safetoplevelnavigationfigure.png "SafeTopLevelNavigationFigure")
![Relationship between application navigation and browser navigation.](./media/security-wpf/application-browser-navigation-relationship.png)

The type of content that is considered safe for an [!INCLUDE[TLA2#tla_xbap](../../../includes/tla2sharptla-xbap-md.md)] to navigate to is primarily determined by whether application navigation or browser navigation is used.

Expand Down Expand Up @@ -109,7 +109,7 @@ ms.assetid: ee1baea0-3611-4e36-9ad6-fcd5205376fb

The **Security Settings** dialog box appears and you can configure the security settings for the selected zone.

![Security Settings dialog box](./media/wpfsecurityfigure1.PNG "WPFSecurityFigure1")
![Screenshot that shows the Security Settings dialog box.](./media/security-wpf/windows-presentation-foundation-security-settings.png)

> [!NOTE]
> You can also get to the Internet Options dialog box from Internet Explorer. Click **Tools** and then click **Internet Options**.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,17 @@ Option Infer { On | Off }

When you set `Option Infer` to `On`, you can declare local variables without explicitly stating a data type. The compiler infers the data type of a variable from the type of its initialization expression.

In the following illustration, `Option Infer` is turned on. The variable in the declaration `Dim someVar = 2` is declared as an integer by type inference.
In the following illustration, `Option Infer` is turned on. The variable in the declaration `Dim someVar = 2` is declared as an integer by type inference.

The following screenshot shows IntelliSense when Option Infer is on:

![IntelliSense view of the declaration.](../../../visual-basic/language-reference/statements/media/optioninferasinteger.png "optionInferAsInteger")
IntelliSense when Option Infer is on
![Screenshot showing IntelliSense view when Option Infer is on.](./media/option-infer-statement/option-infer-as-integer-on.png)

In the following illustration, `Option Infer` is turned off. The variable in the declaration `Dim someVar = 2` is declared as an `Object` by type inference. In this example, the **Option Strict** setting is set to **Off** on the [Compile Page, Project Designer (Visual Basic)](/visualstudio/ide/reference/compile-page-project-designer-visual-basic).

![IntelliSense view of the declaration.](../../../visual-basic/language-reference/statements/media/optioninferasobject.png "optionInferAsObject")
IntelliSense when Option Infer is off
The following screenshot shows IntelliSense when Option Infer is off:

![Screenshot showing IntelliSense view when Option Infer is off.](./media/option-infer-statement/option-infer-as-object-off.png)

> [!NOTE]
> When a variable is declared as an `Object`, the run-time type can change while the program is running. Visual Basic performs operations called *boxing* and *unboxing* to convert between an `Object` and a value type, which makes execution slower. For information about boxing and unboxing, see the [Visual Basic Language Specification](~/_vblang/spec/conversions.md#value-type-conversions).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ ms.assetid: ecacb09b-a4c9-42be-98b2-a15d368b5db8
# Loop Structures (Visual Basic)
Visual Basic loop structures allow you to run one or more lines of code repetitively. You can repeat the statements in a loop structure until a condition is `True`, until a condition is `False`, a specified number of times, or once for each element in a collection.

The following illustration shows a loop structure that runs a set of statements until a condition becomes true.
The following illustration shows a loop structure that runs a set of statements until a condition becomes true:

![Flow chart of a Do...Until loop](../../../../visual-basic/programming-guide/language-features/control-flow/media/dountilloop.gif "DoUntilLoop")
Running a set of statements until a condition becomes true
![Flow chart that shows a Do...Until loop.](./media/loop-structures/do-until-loop-true-condition.gif)

## While Loops
The `While`...`End While` construction runs a set of statements as long as the condition specified in the `While` statement is `True`. For more information, see [While...End While Statement](../../../../visual-basic/language-reference/statements/while-end-while-statement.md).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ An instance of a class, an object, is created by using the `New` keyword. Initia

When an instance of a derived class is created, the `Sub New` constructor of the base class executes first, followed by constructors in derived classes. This happens because the first line of code in a `Sub New` constructor uses the syntax `MyBase.New()`to call the constructor of the class immediately above itself in the class hierarchy. The `Sub New` constructor is then called for each class in the class hierarchy until the constructor for the base class is reached. At that point, the code in the constructor for the base class executes, followed by the code in each constructor in all derived classes and the code in the most derived classes is executed last.

![Constructors and Inheritance](../../../../visual-basic/programming-guide/language-features/objects-and-classes/media/vaconstructorsinheritance.gif "vaConstructorsInheritance")
![Screenshot showing class hierarchy constructors and inheritance.](./media/object-lifetime-how-objects-are-created-and-destroyed/subnew-constructor-inheritance.gif)

When an object is no longer needed, the CLR calls the <xref:System.Object.Finalize%2A> method for that object before freeing its memory. The <xref:System.Object.Finalize%2A> method is called a `destructor` because it performs cleanup tasks, such as saving state information, closing files and connections to databases, and other tasks that must be done before releasing the object.

![Constructors Inheritance2](../../../../visual-basic/programming-guide/language-features/objects-and-classes/media/vaconstructorsinheritance_2.gif "vaConstructorsInheritance_2")
![Screenshot showing the Finalize method destructor.](./media/object-lifetime-how-objects-are-created-and-destroyed/finalize-method-destructor.gif)

## IDisposable Interface
Class instances often control resources not managed by the CLR, such as Windows handles and database connections. These resources must be disposed of in the `Finalize` method of the class, so that they will be released when the object is destroyed by the garbage collector. However, the garbage collector destroys objects only when the CLR requires more free memory. This means that the resources may not be released until long after the object goes out of scope.
Expand Down