# Class SourceCodeInfo.Types.Location (3.27.1)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [3.27.1 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfo.Types.Location)
- [3.23.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/3.23.0/Google.Protobuf.Reflection.SourceCodeInfo.Types.Location)
- [3.15.8](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/3.15.8/Google.Protobuf.Reflection.SourceCodeInfo.Types.Location)

    public sealed class SourceCodeInfo.Types.Location : IMessage<SourceCodeInfo.Types.Location>, IEquatable<SourceCodeInfo.Types.Location>, IDeepCloneable<SourceCodeInfo.Types.Location>, IBufferMessage, IMessage

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> SourceCodeInfo.Types.Location

## Implements

[IMessage](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1)[SourceCodeInfo](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfo)[Types](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfo.Types)[Location](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfo.Types.Location), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[SourceCodeInfo](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfo)[Types](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfo.Types)[Location](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfo.Types.Location), [IDeepCloneable](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1)[SourceCodeInfo](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfo)[Types](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfo.Types)[Location](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfo.Types.Location), [IBufferMessage](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage), [IMessage](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage)

## Inherited Members

[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals)

## Namespace

[Google.Protobuf.Reflection](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection)

## Assembly

Google.Protobuf.dll

## Constructors

### Location()

    public Location()

### Location(Location)

    public Location(SourceCodeInfo.Types.Location other)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `other` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfohttps://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfo.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfo.Types.Location` |

## Fields

### LeadingCommentsFieldNumber

    public const int LeadingCommentsFieldNumber = 3

Field number for the "leading_comments" field.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int32` |   |

### LeadingDetachedCommentsFieldNumber

    public const int LeadingDetachedCommentsFieldNumber = 6

Field number for the "leading_detached_comments" field.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int32` |   |

### PathFieldNumber

    public const int PathFieldNumber = 1

Field number for the "path" field.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int32` |   |

### SpanFieldNumber

    public const int SpanFieldNumber = 2

Field number for the "span" field.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int32` |   |

### TrailingCommentsFieldNumber

    public const int TrailingCommentsFieldNumber = 4

Field number for the "trailing_comments" field.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int32` |   |

## Properties

### Descriptor

    public static MessageDescriptor Descriptor { get; }

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.MessageDescriptor` |   |

### HasLeadingComments

    public bool HasLeadingComments { get; }

Gets whether the "leading_comments" field is set

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

### HasTrailingComments

    public bool HasTrailingComments { get; }

Gets whether the "trailing_comments" field is set

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

### LeadingComments

    public string LeadingComments { get; set; }

If this SourceCodeInfo represents a complete declaration, these are any
comments appearing before and after the declaration which appear to be
attached to the declaration.

A series of line comments appearing on consecutive lines, with no other
tokens appearing on those lines, will be treated as a single comment.

leading_detached_comments will keep paragraphs of comments that appear
before (but not connected to) the current element. Each paragraph,
separated by empty lines, will be one comment element in the repeated
field.

Only the comment content is provided; comment markers (e.g. //) are
stripped out. For block comments, leading whitespace and an asterisk
will be stripped from the beginning of each line other than the first.
Newlines are included in the output.

Examples:

optional int32 foo = 1; // Comment attached to foo.
// Comment attached to bar.
optional int32 bar = 2;

optional string baz = 3;
// Comment attached to baz.
// Another line attached to baz.

// Comment attached to moo.
//
// Another line attached to moo.
optional double moo = 4;

// Detached comment for corge. This is not leading or trailing comments
// to moo or corge because there are blank lines separating it from
// both.

// Detached comment for corge paragraph 2.

optional string corge = 5;
/\* Block comment attached

- to corge. Leading asterisks
- will be removed. */
  /* Block comment attached to
- grault. \*/
  optional int32 grault = 6;

  // ignored detached comments.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### LeadingDetachedComments

    public RepeatedField<string> LeadingDetachedComments { get; }

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Collections.RepeatedField-1https://learn.microsoft.com/dotnet/api/system.string` |   |

### Parser

    public static MessageParser<SourceCodeInfo.Types.Location> Parser { get; }

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageParser-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfohttps://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfo.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfo.Types.Location` |   |

### Path

    public RepeatedField<int> Path { get; }

Identifies which part of the FileDescriptorProto was defined at this
location.

Each element is a field number or an index. They form a path from
the root FileDescriptorProto to the place where the definition appears.
For example, this path:
\[ 4, 3, 2, 7, 1 \]
refers to:
file.message_type(3) // 4, 3
.field(7) // 2, 7
.name() // 1
This is because FileDescriptorProto.message_type has field number 4:
repeated DescriptorProto message_type = 4;
and DescriptorProto.field has field number 2:
repeated FieldDescriptorProto field = 2;
and FieldDescriptorProto.name has field number 1:
optional string name = 1;

Thus, the above path gives the location of a field name. If we removed
the last element:
\[ 4, 3, 2, 7 \]
this path refers to the whole field declaration (from the beginning
of the label to the terminating semicolon).

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Collections.RepeatedField-1https://learn.microsoft.com/dotnet/api/system.int32` |   |

### Span

    public RepeatedField<int> Span { get; }

Always has exactly three or four elements: start line, start column,
end line (optional, otherwise assumed same as start line), end column.
These are packed into a single field for efficiency. Note that line
and column numbers are zero-based -- typically you will want to add
1 to each before displaying to a user.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Collections.RepeatedField-1https://learn.microsoft.com/dotnet/api/system.int32` |   |

### TrailingComments

    public string TrailingComments { get; set; }

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

## Methods

### CalculateSize()

    public int CalculateSize()

Calculates the size of this message in Protocol Buffer wire format, in bytes.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int32` | The number of bytes required to write this message to a coded output stream. |

### ClearLeadingComments()

    public void ClearLeadingComments()

Clears the value of the "leading_comments" field

### ClearTrailingComments()

    public void ClearTrailingComments()

Clears the value of the "trailing_comments" field

### Clone()

    public SourceCodeInfo.Types.Location Clone()

Creates a deep clone of this object.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfohttps://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfo.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfo.Types.Location` | A deep clone of this object. |

### Equals(Location)

    public bool Equals(SourceCodeInfo.Types.Location other)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `other` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfohttps://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfo.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfo.Types.Location` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

### Equals(object)

    public override bool Equals(object other)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `other` | `https://learn.microsoft.com/dotnet/api/system.object` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

**Overrides** [object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object))

### GetHashCode()

    public override int GetHashCode()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.int32` |   |

**Overrides** [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)

### MergeFrom(CodedInputStream)

    public void MergeFrom(CodedInputStream input)

Merges the data from the specified coded input stream with the current message.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `input` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.CodedInputStream` |

**Remarks** See the user guide for precise merge semantics.

### MergeFrom(Location)

    public void MergeFrom(SourceCodeInfo.Types.Location other)

Merges the given message into this one.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `other` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfohttps://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfo.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Reflection.SourceCodeInfo.Types.Location` |

**Remarks** See the user guide for precise merge semantics.

### ToString()

    public override string ToString()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

**Overrides** [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

### WriteTo(CodedOutputStream)

    public void WriteTo(CodedOutputStream output)

Writes the data to the given coded output stream.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `output` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.CodedOutputStream` Coded output stream to write the data to. Must not be null. |

## Extension Methods

[MessageExtensions.IsInitialized(IMessage)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_IsInitialized_Google_Protobuf_IMessage_) [MessageExtensions.MergeDelimitedFrom(IMessage, Stream)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_MergeDelimitedFrom_Google_Protobuf_IMessage_System_IO_Stream_) [MessageExtensions.MergeFrom(IMessage, ByteString)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_MergeFrom_Google_Protobuf_IMessage_Google_Protobuf_ByteString_) [MessageExtensions.MergeFrom(IMessage, ReadOnlySequence\<byte\>)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_MergeFrom_Google_Protobuf_IMessage_System_Buffers_ReadOnlySequence_System_Byte__) [MessageExtensions.MergeFrom(IMessage, byte\[\])](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_MergeFrom_Google_Protobuf_IMessage_System_Byte___) [MessageExtensions.MergeFrom(IMessage, byte\[\], int, int)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_MergeFrom_Google_Protobuf_IMessage_System_Byte___System_Int32_System_Int32_) [MessageExtensions.MergeFrom(IMessage, Stream)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_MergeFrom_Google_Protobuf_IMessage_System_IO_Stream_) [MessageExtensions.MergeFrom(IMessage, ReadOnlySpan\<byte\>)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_MergeFrom_Google_Protobuf_IMessage_System_ReadOnlySpan_System_Byte__) [MessageExtensions.ToByteArray(IMessage)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_ToByteArray_Google_Protobuf_IMessage_) [MessageExtensions.ToByteString(IMessage)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_ToByteString_Google_Protobuf_IMessage_) [MessageExtensions.WriteDelimitedTo(IMessage, Stream)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_WriteDelimitedTo_Google_Protobuf_IMessage_System_IO_Stream_) [MessageExtensions.WriteTo(IMessage, IBufferWriter\<byte\>)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_WriteTo_Google_Protobuf_IMessage_System_Buffers_IBufferWriter_System_Byte__) [MessageExtensions.WriteTo(IMessage, Stream)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_WriteTo_Google_Protobuf_IMessage_System_IO_Stream_) [MessageExtensions.WriteTo(IMessage, Span\<byte\>)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_WriteTo_Google_Protobuf_IMessage_System_Span_System_Byte__)