public sealed class TrafficPortSelector : IMessage<TrafficPortSelector>, IEquatable<TrafficPortSelector>, IDeepCloneable<TrafficPortSelector>, IBufferMessage, IMessage
Reference documentation and code samples for the Network Services v1 API class TrafficPortSelector.
Optional. A list of ports. Can be port numbers or port range
(example, [80-90] specifies all ports from 80 to 90, including
80 and 90) or named ports or * to specify all ports. If the
list is empty, all ports are selected.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThis page provides reference documentation for the \u003ccode\u003eTrafficPortSelector\u003c/code\u003e class within the Network Services v1 API in .NET.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eTrafficPortSelector\u003c/code\u003e class is used to define a port-based selector for network traffic, inheriting from the base \u003ccode\u003eobject\u003c/code\u003e class and implementing multiple interfaces for message handling and cloning.\u003c/p\u003e\n"],["\u003cp\u003eIt includes constructors for creating new instances, one empty, and another to use a preexisting \u003ccode\u003eTrafficPortSelector\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe main functionality is provided by the \u003ccode\u003ePorts\u003c/code\u003e property, which accepts a list of ports, ranges, or named ports, and using * will select all ports.\u003c/p\u003e\n"],["\u003cp\u003eThe latest stable version of TrafficPortSelector is version 1.0.0.\u003c/p\u003e\n"]]],[],null,["# Network Services v1 API - Class TrafficPortSelector (1.3.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.3.0 (latest)](/dotnet/docs/reference/Google.Cloud.NetworkServices.V1/latest/Google.Cloud.NetworkServices.V1.TrafficPortSelector)\n- [1.2.0](/dotnet/docs/reference/Google.Cloud.NetworkServices.V1/1.2.0/Google.Cloud.NetworkServices.V1.TrafficPortSelector)\n- [1.1.0](/dotnet/docs/reference/Google.Cloud.NetworkServices.V1/1.1.0/Google.Cloud.NetworkServices.V1.TrafficPortSelector)\n- [1.0.0](/dotnet/docs/reference/Google.Cloud.NetworkServices.V1/1.0.0/Google.Cloud.NetworkServices.V1.TrafficPortSelector) \n\n public sealed class TrafficPortSelector : IMessage\u003cTrafficPortSelector\u003e, IEquatable\u003cTrafficPortSelector\u003e, IDeepCloneable\u003cTrafficPortSelector\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Network Services v1 API class TrafficPortSelector.\n\nSpecification of a port-based selector. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e TrafficPortSelector \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[TrafficPortSelector](/dotnet/docs/reference/Google.Cloud.NetworkServices.V1/latest/Google.Cloud.NetworkServices.V1.TrafficPortSelector), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[TrafficPortSelector](/dotnet/docs/reference/Google.Cloud.NetworkServices.V1/latest/Google.Cloud.NetworkServices.V1.TrafficPortSelector), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[TrafficPortSelector](/dotnet/docs/reference/Google.Cloud.NetworkServices.V1/latest/Google.Cloud.NetworkServices.V1.TrafficPortSelector), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.NetworkServices.V1](/dotnet/docs/reference/Google.Cloud.NetworkServices.V1/latest/Google.Cloud.NetworkServices.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.NetworkServices.V1.dll\n\nConstructors\n------------\n\n### TrafficPortSelector()\n\n public TrafficPortSelector()\n\n### TrafficPortSelector(TrafficPortSelector)\n\n public TrafficPortSelector(TrafficPortSelector other)\n\nProperties\n----------\n\n### Ports\n\n public RepeatedField\u003cstring\u003e Ports { get; }\n\nOptional. A list of ports. Can be port numbers or port range\n(example, \\[80-90\\] specifies all ports from 80 to 90, including\n80 and 90) or named ports or \\* to specify all ports. If the\nlist is empty, all ports are selected."]]