Skip to content
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
72 changes: 36 additions & 36 deletions docs/csharp/language-reference/compiler-messages/cs0106.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
---
title: "Compiler Error CS0106"
ms.date: 06/15/2017
f1_keywords:
f1_keywords:
- "CS0106"
helpviewer_keywords:
helpviewer_keywords:
- "CS0106"
ms.assetid: 8dec906a-ed69-4ed5-aa61-c8600d138200
---
# Compiler Error CS0106
The modifier 'modifier' is not valid for this item
A class or interface member was marked with an invalid access modifier. The following examples describe some of these invalid modifiers:
- The [static](../../../csharp/language-reference/keywords/static.md) and [public](../../../csharp/language-reference/keywords/public.md) modifiers are not permitted on interface methods.
The modifier 'modifier' is not valid for this item

A class or interface member was marked with an invalid access modifier. The following examples describe some of these invalid modifiers:

- The [static](../../../csharp/language-reference/keywords/static.md) and [public](../../../csharp/language-reference/keywords/public.md) modifiers are not permitted on interface methods.

- The [static](../../../csharp/language-reference/keywords/static.md) modifier is not permitted on a [local function](../../programming-guide/classes-and-structs/local-functions.md).
- The `public` keyword is not allowed on an explicit interface declaration. In this case, remove the `public` keyword from the explicit interface declaration.
- The [abstract](../../../csharp/language-reference/keywords/abstract.md) keyword is not allowed on an explicit interface declaration because an explicit interface implementation can never be overridden.

- The `public` keyword is not allowed on an explicit interface declaration. In this case, remove the `public` keyword from the explicit interface declaration.

- The [abstract](../../../csharp/language-reference/keywords/abstract.md) keyword is not allowed on an explicit interface declaration because an explicit interface implementation can never be overridden.

- Access modifiers are not allowed on a [local function](../../programming-guide/classes-and-structs/local-functions.md). Local functions are always private.
In prior releases of Visual Studio, the `static` modifier was not permitted on a class, but `static` classes are allowed starting with [!INCLUDE[vsprvsext](~/includes/vsprvsext-md.md)].
For more information, see [Interfaces](../../../csharp/programming-guide/interfaces/index.md)
## Example
The following sample generates CS0106.
```csharp
// CS0106.cs
namespace MyNamespace
{
interface I
{
void m();
static public void f(); // CS0106
}
public class MyClass
{
public void I.m() {} // CS0106
public static void Main() {}
}
}

In prior releases of Visual Studio, the `static` modifier was not permitted on a class, but `static` classes are allowed starting with Visual Studio 2005.

For more information, see [Interfaces](../../../csharp/programming-guide/interfaces/index.md)

## Example
The following sample generates CS0106.

```csharp
// CS0106.cs
namespace MyNamespace
{
interface I
{
void m();
static public void f(); // CS0106
}

public class MyClass
{
public void I.m() {} // CS0106
public static void Main() {}
}
}
```
41 changes: 21 additions & 20 deletions docs/csharp/misc/cs0227.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
---
title: "Compiler Error CS0227"
ms.date: 07/20/2015
f1_keywords:
f1_keywords:
- "CS0227"
helpviewer_keywords:
helpviewer_keywords:
- "CS0227"
ms.assetid: b595a1c9-8204-4ff7-a1d0-258b0b1d6ff7
---
# Compiler Error CS0227
Unsafe code may only appear if compiling with /unsafe

If source code contains the [unsafe](../../csharp/language-reference/keywords/unsafe.md) keyword, then the [/unsafe](../../csharp/language-reference/compiler-options/unsafe-compiler-option.md) compiler option must also be used. For more information, see [Unsafe Code and Pointers](../../csharp/programming-guide/unsafe-code-pointers/index.md).

To set the unsafe option in [!INCLUDE[vs_current_long](~/includes/vs-current-long-md.md)], click on **Project** in the main menu, select the **Build** pane, and check the box that says "allow unsafe code."

The following sample, when compiled without **/unsafe**, will generate CS0227:

```csharp
// CS0227.cs
public class MyClass
{
unsafe public static void Main() // CS0227
{
}
}
```


Unsafe code may only appear if compiling with /unsafe

If source code contains the [unsafe](../../csharp/language-reference/keywords/unsafe.md) keyword, then the [/unsafe](../../csharp/language-reference/compiler-options/unsafe-compiler-option.md) compiler option must also be used. For more information, see [Unsafe Code and Pointers](../../csharp/programming-guide/unsafe-code-pointers/index.md).

To set the unsafe option in Visual Studio 2012, click on **Project** in the main menu, select the **Build** pane, and check the box that says "allow unsafe code."

The following sample, when compiled without **/unsafe**, generates CS0227:

```csharp
// CS0227.cs
public class MyClass
{
unsafe public static void Main() // CS0227
{
}
}
```

## See Also

- [C# Compiler Errors](../../csharp/language-reference/compiler-messages/index.md)
55 changes: 28 additions & 27 deletions docs/csharp/misc/cs0809.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
---
title: "Compiler Warning (level 1) CS0809"
ms.date: 07/20/2015
f1_keywords:
f1_keywords:
- "CS0809"
helpviewer_keywords:
helpviewer_keywords:
- "CS0809"
ms.assetid: 2c2f0248-ab3a-4cdc-a1b0-2f0e05eac4c9
---
# Compiler Warning (level 1) CS0809
Obsolete member 'memberA' overrides non-obsolete member 'memberB'.

Typically, a member that is marked as obsolete should not override a member that is not marked as obsolete. This warning is generated in [!INCLUDE[vs_orcas_long](~/includes/vs-orcas-long-md.md)] but not in [!INCLUDE[vsprvslong](~/includes/vsprvslong-md.md)].

## To correct this error

1. Remove the `Obsolete` attribute from the overriding member, or add it to the base class member.

## Example

```csharp
// CS0809.cs
public class Base
{
public virtual void Test1()
{
}
}
public class C : Base
{
[System.Obsolete()]
public override void Test1() // CS0809
{
}
}

Obsolete member 'memberA' overrides non-obsolete member 'memberB'.

Typically, a member that is marked as obsolete should not override a member that is not marked as obsolete. This warning is generated in Visual Studio 2008 but not in Visual Studio 2005.

## To correct this error

Remove the `Obsolete` attribute from the overriding member, or add it to the base class member.

## Example

```csharp
// CS0809.cs
public class Base
{
public virtual void Test1()
{
}
}
public class C : Base
{
[System.Obsolete()]
public override void Test1() // CS0809
{
}
}
```
40 changes: 21 additions & 19 deletions docs/csharp/misc/cs1727.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
---
title: "Compiler Error CS1727"
ms.date: 07/20/2015
f1_keywords:
f1_keywords:
- "CS1727"
helpviewer_keywords:
helpviewer_keywords:
- "CS1727"
ms.assetid: 66478a58-e0f6-4886-b940-5473ad485a01
---
# Compiler Error CS1727
Cannot send error report automatically without authorization. Please visit '' to authorize sending error report.

The Web site listed in the error text explains how to enable automatic error reporting for [!INCLUDE[vsprvslong](~/includes/vsprvslong-md.md)] command line tools.

## Example
The following sample generates CS1727.

```csharp
// CS1727.cs
// compile with: /errorreport:send
// CS1727 expected
class Test
{
static void Main(){}
}
```


Cannot send error report automatically without authorization. Please visit '' to authorize sending error report.

The Web site listed in the error text explains how to enable automatic error reporting for Visual Studio 2005 command line tools.

## Example

The following sample generates CS1727.

```csharp
// CS1727.cs
// compile with: /errorreport:send
// CS1727 expected
class Test
{
static void Main(){}
}
```

## See Also

- [/errorreport (C# Compiler Options)](../../csharp/language-reference/compiler-options/errorreport-compiler-option.md)
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ There are various ways to extend [!INCLUDE[vbteclinq](~/includes/vbteclinq-md.md
There are two ways you can enable [!INCLUDE[vbteclinq](~/includes/vbteclinq-md.md)] querying of in-memory data. If the data is of a type that implements <xref:System.Collections.Generic.IEnumerable%601>, you can query the data by using [!INCLUDE[vbteclinq](~/includes/vbteclinq-md.md)] to Objects. If it does not make sense to enable enumeration of your type by implementing the <xref:System.Collections.Generic.IEnumerable%601> interface, you can define [!INCLUDE[vbteclinq](~/includes/vbteclinq-md.md)] standard query operator methods in that type or create [!INCLUDE[vbteclinq](~/includes/vbteclinq-md.md)] standard query operator methods that extend the type. Custom implementations of the standard query operators should use deferred execution to return the results.

### Remote Data
The best option for enabling [!INCLUDE[vbteclinq](~/includes/vbteclinq-md.md)] querying of a remote data source is to implement the <xref:System.Linq.IQueryable%601> interface. However, this differs from extending a provider such as [!INCLUDE[vbtecdlinq](~/includes/vbtecdlinq-md.md)] for a data source. No provider models for extending existing [!INCLUDE[vbteclinq](~/includes/vbteclinq-md.md)] technologies, such as [!INCLUDE[vbtecdlinq](~/includes/vbtecdlinq-md.md)], to other types of data source are available in [!INCLUDE[vs_orcas_long](~/includes/vs-orcas-long-md.md)].
The best option for enabling [!INCLUDE[vbteclinq](~/includes/vbteclinq-md.md)] querying of a remote data source is to implement the <xref:System.Linq.IQueryable%601> interface. However, this differs from extending a provider such as [!INCLUDE[vbtecdlinq](~/includes/vbtecdlinq-md.md)] for a data source. No provider models for extending existing [!INCLUDE[vbteclinq](~/includes/vbteclinq-md.md)] technologies, such as [!INCLUDE[vbtecdlinq](~/includes/vbtecdlinq-md.md)], to other types of data source are available in Visual Studio 2008.

## IQueryable LINQ Providers
[!INCLUDE[vbteclinq](~/includes/vbteclinq-md.md)] providers that implement <xref:System.Linq.IQueryable%601> can vary widely in their complexity. This section discusses the different levels of complexity.
Expand Down
74 changes: 38 additions & 36 deletions docs/framework/app-domains/create-assemblies.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Creating Assemblies"
ms.date: "03/30/2017"
helpviewer_keywords:
helpviewer_keywords:
- "assemblies [.NET Framework], multifile"
- "single-file assemblies"
- "assemblies [.NET Framework], creating"
Expand All @@ -11,38 +11,40 @@ author: "rpetrusha"
ms.author: "ronpet"
---
# Creating Assemblies
You can create single-file or multifile assemblies using an IDE, such as [!INCLUDE[vsprvslong](../../../includes/vsprvslong-md.md)], or the compilers and tools provided by the [!INCLUDE[winsdklong](../../../includes/winsdklong-md.md)]. The simplest assembly is a single file that has a simple name and is loaded into a single application domain. This assembly cannot be referenced by other assemblies outside the application directory and does not undergo version checking. To uninstall the application made up of the assembly, you simply delete the directory where it resides. For many developers, an assembly with these features is all that is needed to deploy an application.

You can create a multifile assembly from several code modules and resource files. You can also create an assembly that can be shared by multiple applications. A shared assembly must have a strong name and can be deployed in the global assembly cache.

You have several options when grouping code modules and resources into assemblies, depending on the following factors:

- Versioning

Group modules that should have the same version information.

- Deployment

Group code modules and resources that support your model of deployment.

- Reuse

Group modules if they can be logically used together for some purpose. For example, an assembly consisting of types and classes used infrequently for program maintenance can be put in the same assembly. In addition, types that you intend to share with multiple applications should be grouped into an assembly and the assembly should be signed with a strong name.

- Security

Group modules containing types that require the same security permissions.

- Scoping

Group modules containing types whose visibility should be restricted to the same assembly.

Special considerations must be made when making common language runtime assemblies available to unmanaged COM applications. For more information about working with unmanaged code, see [Exposing .NET Framework Components to COM](../../../docs/framework/interop/exposing-dotnet-components-to-com.md).

## See Also
[Programming with Assemblies](../../../docs/framework/app-domains/programming-with-assemblies.md)
[Assembly Versioning](../../../docs/framework/app-domains/assembly-versioning.md)
[How to: Build a Single-File Assembly](../../../docs/framework/app-domains/how-to-build-a-single-file-assembly.md)
[How to: Build a Multifile Assembly](../../../docs/framework/app-domains/how-to-build-a-multifile-assembly.md)
[How the Runtime Locates Assemblies](../../../docs/framework/deployment/how-the-runtime-locates-assemblies.md)
[Multifile Assemblies](../../../docs/framework/app-domains/multifile-assemblies.md)

You can create single-file or multifile assemblies using an IDE, such as Visual Studio, or the compilers and tools provided by the [!INCLUDE[winsdklong](../../../includes/winsdklong-md.md)]. The simplest assembly is a single file that has a simple name and is loaded into a single application domain. This assembly cannot be referenced by other assemblies outside the application directory and does not undergo version checking. To uninstall the application made up of the assembly, you simply delete the directory where it resides. For many developers, an assembly with these features is all that is needed to deploy an application.

You can create a multifile assembly from several code modules and resource files. You can also create an assembly that can be shared by multiple applications. A shared assembly must have a strong name and can be deployed in the global assembly cache.

You have several options when grouping code modules and resources into assemblies, depending on the following factors:

- Versioning

Group modules that should have the same version information.

- Deployment

Group code modules and resources that support your model of deployment.

- Reuse

Group modules if they can be logically used together for some purpose. For example, an assembly consisting of types and classes used infrequently for program maintenance can be put in the same assembly. In addition, types that you intend to share with multiple applications should be grouped into an assembly and the assembly should be signed with a strong name.

- Security

Group modules containing types that require the same security permissions.

- Scoping

Group modules containing types whose visibility should be restricted to the same assembly.

Special considerations must be made when making common language runtime assemblies available to unmanaged COM applications. For more information about working with unmanaged code, see [Exposing .NET Framework Components to COM](../../../docs/framework/interop/exposing-dotnet-components-to-com.md).

## See Also

- [Programming with Assemblies](../../../docs/framework/app-domains/programming-with-assemblies.md)
- [Assembly Versioning](../../../docs/framework/app-domains/assembly-versioning.md)
- [How to: Build a Single-File Assembly](../../../docs/framework/app-domains/how-to-build-a-single-file-assembly.md)
- [How to: Build a Multifile Assembly](../../../docs/framework/app-domains/how-to-build-a-multifile-assembly.md)
- [How the Runtime Locates Assemblies](../../../docs/framework/deployment/how-the-runtime-locates-assemblies.md)
- [Multifile Assemblies](../../../docs/framework/app-domains/multifile-assemblies.md)
Loading