コード例 #1
0
        public AttributeExamplePreview(AttributeExampleInfo exampleInfo)
        {
            this.ExampleInfo = exampleInfo;

            try
            {
                this.highlightedCode = SyntaxHighlighter.Parse(this.ExampleInfo.Code);
            }
            catch (Exception ex)
            {
                Debug.LogException(ex);
                this.highlightedCode = this.ExampleInfo.Code;
                this.showRaw         = true;
            }
        }
コード例 #2
0
        // TODO: The names of GetAttributeExampleInfos and GetExample methods are kinda confusing
        // and doesn't clearly indicate the difference between the two methods.
        public static AttributeExampleInfo[] GetAttributeExampleInfos(Type attributeType)
        {
            if (attributeType == null)
            {
                throw new ArgumentNullException("attributeType");
            }

            AttributeExampleInfo[] examples;
            if (InternalAttributeExampleInfoMap.Map.TryGetValue(attributeType, out examples) == false)
            {
                examples = new AttributeExampleInfo[0];
            }

            return(examples);
        }