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
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// <Snippet1>
using System;
using System.Numerics;

public class Example
{
public static void Main()
{
BigInteger[] values = { 2, 100, BigInteger.Pow(1000, 100),
BigInteger.Pow(2, 64) };
foreach (var value in values)
Console.WriteLine("The square root of {0} is {1}", value,
Math.Exp(BigInteger.Log(value) / 2));
}
}
// The example displays the following output:
// The square root of 2 is 1.41421356237309
// The square root of 100 is 10
// The square root of 1000000000000000000000000000000000000000000000000000000000000
// 00000000000000000000000000000000000000000000000000000000000000000000000000000000
// 00000000000000000000000000000000000000000000000000000000000000000000000000000000
// 00000000000000000000000000000000000000000000000000000000000000000000000000000000
// is 9.99999999999988E+149
// The square root of 18446744073709551616 is 4294967296
// </Snippet1>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// <Snippet1>
using System;
using System.Numerics;

public class Example
{
public static void Main()
{
Complex[] values = { new Complex(1.53, 9.26),
new Complex(2.53, -8.12),
new Complex(-2.81, 5.32),
new Complex(-1.09, -3.43),
new Complex(Double.MinValue/2, Double.MinValue/2) };
foreach (Complex value in values)
Console.WriteLine("Exp(Log({0}) = {1}", value,
Complex.Exp(Complex.Log(value)));
}
}
// The example displays the following output:
// Exp(Log((1.53, 9.26)) = (1.53, 9.26)
// Exp(Log((2.53, -8.12)) = (2.53, -8.12)
// Exp(Log((-2.81, 5.32)) = (-2.81, 5.32)
// Exp(Log((-1.09, -3.43)) = (-1.09, -3.43)
// Exp(Log((-8.98846567431158E+307, -8.98846567431158E+307)) = (-8.98846567431161E+307, -8.98846567431161E+307)
// </Snippet1>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<!--

This file is used by the publish/package process of your Web project. You can customize the behavior of this process

by customizing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121.

-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<LaunchASiteUrlAfterPublish>False</LaunchASiteUrlAfterPublish>
<SiteUrlToLaunchAfterPublish />
<MSDeployServiceURL>localhost</MSDeployServiceURL>
<DeployIisAppPath>Default Web Site\WebApplication1</DeployIisAppPath>
<RemoteSitePhysicalPath />
<AllowUntrustedCertificate>False</AllowUntrustedCertificate>
<SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
<DeployAsIisApp>True</DeployAsIisApp>
<MSDeployPublishMethod>InProc</MSDeployPublishMethod>
<UserName />
<SavePWD>False</SavePWD>
<PublishDatabaseSettings>
<Objects xmlns="">
<ObjectGroup Name="DefaultConnection" Order="1" Enabled="False">
<Destination Path="Data Source=(LocalDB)\v11.0;Initial Catalog=aspnet-WebApplication1-20111111115649;Integrated Security=True" />
<Object Type="DbSqlPackage">
<PreSource Path="Data Source=(LocalDB)\v11.0;Initial Catalog=aspnet-WebApplication1-20111111115649;Integrated Security=True" />
<Source Path="$(IntermediateOutputPath)AutoScripts\DefaultConnection_IncrementalSchemaOnly.dacpac" Action="Publish" />
</Object>
<Object Type="DbFullSql" Enabled="False">
<PreSource Path="Data Source=(LocalDB)\v11.0;Initial Catalog=aspnet-WebApplication1-20111111115649;Integrated Security=True" ScriptSchema="False" ScriptData="True" CopyAllFullTextCatalogs="False" DriDefaults="True" />
<Source Path="$(IntermediateOutputPath)AutoScripts\DefaultConnection_DataOnly.sql" Transacted="True" />
</Object>
</ObjectGroup>
</Objects>
</PublishDatabaseSettings>
</PropertyGroup>
<ItemGroup>
<MSDeployParameterValue Include="$(DeployParameterPrefix)DefaultConnection-Web.config Connection String">
<ParameterValue>Data Source=(LocalDB)\v11.0;Initial Catalog=aspnet-WebApplication1-20111111115649;Integrated Security=True;MultipleActiveResultSets=True</ParameterValue>
</MSDeployParameterValue>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<!--

This file is used by the publish/package process of your Web project. You can customize the behavior of this process

by customizing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121.

-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<LaunchASiteUrlAfterPublish>False</LaunchASiteUrlAfterPublish>
<SiteUrlToLaunchAfterPublish />
<MSDeployServiceURL>localhost</MSDeployServiceURL>
<DeployIisAppPath>Default Web Site\WebApplication1</DeployIisAppPath>
<RemoteSitePhysicalPath />
<AllowUntrustedCertificate>False</AllowUntrustedCertificate>
<SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
<DeployAsIisApp>True</DeployAsIisApp>
<MSDeployPublishMethod>InProc</MSDeployPublishMethod>
<UserName />
<SavePWD>False</SavePWD>
<PublishDatabaseSettings>
<Objects xmlns="">
<ObjectGroup Name="DefaultConnection" Order="1" Enabled="False">
<Destination Path="Data Source=(LocalDB)\v11.0;Initial Catalog=aspnet-WebApplication1-20111111115649;Integrated Security=True" />
<Object Type="DbSqlPackage">
<PreSource Path="Data Source=(LocalDB)\v11.0;Initial Catalog=aspnet-WebApplication1-20111111115649;Integrated Security=True" />
<Source Path="$(IntermediateOutputPath)AutoScripts\DefaultConnection_IncrementalSchemaOnly.dacpac" Action="Publish" />
</Object>
<Object Type="DbFullSql" Enabled="False">
<PreSource Path="Data Source=(LocalDB)\v11.0;Initial Catalog=aspnet-WebApplication1-20111111115649;Integrated Security=True" ScriptSchema="False" ScriptData="True" CopyAllFullTextCatalogs="False" DriDefaults="True" />
<Source Path="$(IntermediateOutputPath)AutoScripts\DefaultConnection_DataOnly.sql" Transacted="True" />
</Object>
</ObjectGroup>
</Objects>
</PublishDatabaseSettings>
</PropertyGroup>
<ItemGroup>
<MSDeployParameterValue Include="$(DeployParameterPrefix)DefaultConnection-Web.config Connection String">
<ParameterValue>Data Source=(LocalDB)\v11.0;Initial Catalog=aspnet-WebApplication1-20111111115649;Integrated Security=True;MultipleActiveResultSets=True</ParameterValue>
</MSDeployParameterValue>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<!--

This file is used by the publish/package process of your Web project. You can customize the behavior of this process

by customizing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121.

-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<LaunchASiteUrlAfterPublish>False</LaunchASiteUrlAfterPublish>
<SiteUrlToLaunchAfterPublish />
<MSDeployServiceURL>localhost</MSDeployServiceURL>
<DeployIisAppPath>Default Web Site\WebApplication1</DeployIisAppPath>
<RemoteSitePhysicalPath />
<AllowUntrustedCertificate>False</AllowUntrustedCertificate>
<SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
<DeployAsIisApp>True</DeployAsIisApp>
<MSDeployPublishMethod>InProc</MSDeployPublishMethod>
<UserName />
<SavePWD>False</SavePWD>
<PublishDatabaseSettings>
<Objects xmlns="">
<ObjectGroup Name="DefaultConnection" Order="1" Enabled="False">
<Destination Path="Data Source=(LocalDB)\v11.0;Initial Catalog=aspnet-WebApplication1-20111111115649;Integrated Security=True" />
<Object Type="DbSqlPackage">
<PreSource Path="Data Source=(LocalDB)\v11.0;Initial Catalog=aspnet-WebApplication1-20111111115649;Integrated Security=True" />
<Source Path="$(IntermediateOutputPath)AutoScripts\DefaultConnection_IncrementalSchemaOnly.dacpac" Action="Publish" />
</Object>
<Object Type="DbFullSql" Enabled="False">
<PreSource Path="Data Source=(LocalDB)\v11.0;Initial Catalog=aspnet-WebApplication1-20111111115649;Integrated Security=True" ScriptSchema="False" ScriptData="True" CopyAllFullTextCatalogs="False" DriDefaults="True" />
<Source Path="$(IntermediateOutputPath)AutoScripts\DefaultConnection_DataOnly.sql" Transacted="True" />
</Object>
</ObjectGroup>
</Objects>
</PublishDatabaseSettings>
</PropertyGroup>
<ItemGroup>
<MSDeployParameterValue Include="$(DeployParameterPrefix)DefaultConnection-Web.config Connection String">
<ParameterValue>Data Source=(LocalDB)\v11.0;Initial Catalog=aspnet-WebApplication1-20111111115649;Integrated Security=True;MultipleActiveResultSets=True</ParameterValue>
</MSDeployParameterValue>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">

</form>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;

public partial class _Default : System.Web.UI.Page
{
// <Snippet1>
protected void Page_Load(object sender, EventArgs e)
{
if (User.Identity.IsAuthenticated)
{
Page.Title = "Home page for " + User.Identity.Name;
}
else
{
Page.Title = "Home page for guest user.";
}
}
// </Snippet1>
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
' Visual Basic .NET Document
Option Strict On

' <Snippet1>
Imports System.Numerics

Module Example
Public Sub Main()
Dim values() As BigInteger = { 2, 100, BigInteger.Pow(1000, 100),
BigInteger.Pow(2, 64) }
For Each value In values
Console.WriteLine("The square root of {0} is {1}", value,
Math.Exp(BigInteger.Log(value) / 2))
Next
End Sub
End Module
' The example displays the following output:
' The square root of 2 is 1.41421356237309
' The square root of 100 is 10
' The square root of 1000000000000000000000000000000000000000000000000000000000000
' 00000000000000000000000000000000000000000000000000000000000000000000000000000000
' 00000000000000000000000000000000000000000000000000000000000000000000000000000000
' 00000000000000000000000000000000000000000000000000000000000000000000000000000000
' is 9.99999999999988E+149
' The square root of 18446744073709551616 is 4294967296
' </Snippet1>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
' Visual Basic .NET Document
Option Strict On
' <Snippet1>
Imports System.Numerics

Module Example
Public Sub Main()
Dim values() As Complex = { New Complex(1.53, 9.26),
New Complex(2.53, -8.12),
New Complex(-2.81, 5.32),
New Complex(-1.09, -3.43),
New Complex(Double.MinValue/2, Double.MinValue/2) }
For Each value As Complex In values
Console.WriteLine("Exp(Log({0}) = {1}", value,
Complex.Exp(Complex.Log(value)))
Next
End Sub
End Module
' The example displays the following output:
' Exp(Log((1.53, 9.26)) = (1.53, 9.26)
' Exp(Log((2.53, -8.12)) = (2.53, -8.12)
' Exp(Log((-2.81, 5.32)) = (-2.81, 5.32)
' Exp(Log((-1.09, -3.43)) = (-1.09, -3.43)
' Exp(Log((-8.98846567431158E+307, -8.98846567431158E+307)) = (-8.98846567431161E+307, -8.98846567431161E+307)
' </Snippet1>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>

</div>
</form>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

Partial Class _Default
Inherits System.Web.UI.Page
'<Snippet1>
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If (User.Identity.IsAuthenticated) Then
Page.Title = "Home page for " + User.Identity.Name
Else
Page.Title = "Home page for guest user."
End If
End Sub
'</Snippet1>
End Class
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions xml/System/Span`1+Enumerator.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ If <xref:System.Span%601.Enumerator.MoveNext%2A> passes the end of the <xref:Sys

The enumerator does not have exclusive access to the <xref:System.Span%601>. In addition, the underlying data on which the span is based can also be modified. Therefore, enumerating through a span is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you must implement your own synchronization. For example, the following code has a race condition. It does not ensure that the span will be enumerated before the `ClearContents` method executes. As a result, the underlying array is cleared during enumeration of the span:

[!code-csharp[System.Span<T>.Enumerator-no-synchronization](~/samples/snippets/csharp/api/system/span.enumerator/nosync/program.cs)]
[!code-csharp[System.Span<T>.Enumerator-no-synchronization](~/samples/snippets/csharp/api/system/span.enumerator/nosync/Program.cs)]

If you synchronize access to the array before enumerating the span, as the revised version of the `EnumerateSpan` method does in the following example, the `ClearContents` method doesn't modify underlying span data during enumeration. Note that the example locks the underlying array on which the span is based.

[!code-csharp[System.Span<T>.Enumerator-no-synchronization](~/samples/snippets/csharp/api/system/span.enumerator/sync/program.cs#1)]
[!code-csharp[System.Span<T>.Enumerator-no-synchronization](~/samples/snippets/csharp/api/system/span.enumerator/sync/Program.cs#1)]

Unlike some other enumerator structures in .NET, the <xref:System.Span%601.Enumerator>:

Expand Down