Opc.Ua.ServiceResultException.Create C# (CSharp) Method

Create() public static method

Creates a new instance of a ServiceResultException
public static Create ( Opc.Ua.StatusCode code, int index, DiagnosticInfoCollection diagnosticInfos, IList stringTable ) : ServiceResultException
code Opc.Ua.StatusCode
index int
diagnosticInfos DiagnosticInfoCollection
stringTable IList
return ServiceResultException
        public static ServiceResultException Create(StatusCode code, int index, DiagnosticInfoCollection diagnosticInfos, IList<string> stringTable)
        {
            return new ServiceResultException(new ServiceResult(code, index, diagnosticInfos, stringTable));
        }
        #endregion

Same methods

ServiceResultException::Create ( uint code, Exception e, string format ) : ServiceResultException
ServiceResultException::Create ( uint code, string format ) : ServiceResultException

Usage Example

コード例 #1
0
        /// <summary>
        /// Parses a relative path formatted as a string.
        /// </summary>
        public static RelativePath Parse(string browsePath, ITypeTable typeTree)
        {
            if (typeTree == null)
            {
                throw new ArgumentNullException("typeTree");
            }

            // parse the string.
            RelativePathFormatter formatter = RelativePathFormatter.Parse(browsePath);

            // convert the browse names to node ids.
            RelativePath relativePath = new RelativePath();

            foreach (RelativePathFormatter.Element element in formatter.Elements)
            {
                RelativePathElement parsedElement = new RelativePathElement();

                parsedElement.ReferenceTypeId = null;
                parsedElement.IsInverse       = false;
                parsedElement.IncludeSubtypes = element.IncludeSubtypes;
                parsedElement.TargetName      = element.TargetName;

                switch (element.ElementType)
                {
                case RelativePathFormatter.ElementType.AnyHierarchical:
                {
                    parsedElement.ReferenceTypeId = ReferenceTypeIds.HierarchicalReferences;
                    break;
                }

                case RelativePathFormatter.ElementType.AnyComponent:
                {
                    parsedElement.ReferenceTypeId = ReferenceTypeIds.Aggregates;
                    break;
                }

                case RelativePathFormatter.ElementType.ForwardReference:
                {
                    parsedElement.ReferenceTypeId = typeTree.FindReferenceType(element.ReferenceTypeName);
                    break;
                }

                case RelativePathFormatter.ElementType.InverseReference:
                {
                    parsedElement.ReferenceTypeId = typeTree.FindReferenceType(element.ReferenceTypeName);
                    parsedElement.IsInverse       = true;
                    break;
                }
                }

                if (NodeId.IsNull(parsedElement.ReferenceTypeId))
                {
                    throw ServiceResultException.Create(
                              StatusCodes.BadSyntaxError,
                              "Could not convert BrowseName to a ReferenceTypeId: {0}",
                              element.ReferenceTypeName);
                }

                relativePath.Elements.Add(parsedElement);
            }

            return(relativePath);
        }
All Usage Examples Of Opc.Ua.ServiceResultException::Create