System.CodeDom.CodeTypeReference.RipOffAssemblyInformationFromTypeName C# (CSharp) Method

RipOffAssemblyInformationFromTypeName() private method

private RipOffAssemblyInformationFromTypeName ( string typeName ) : string
typeName string
return string
        private string RipOffAssemblyInformationFromTypeName(string typeName) {
            int start = 0;
            int end = typeName.Length - 1;
            string result = typeName;
            
            // skip white space in the beginning
            while( start < typeName.Length && Char.IsWhiteSpace(typeName[start])) start++;
            while( end >= 0 && Char.IsWhiteSpace(typeName[end])) end--;
                    
            if(start < end) {
                if (typeName[start] =='[' && typeName[end] == ']') {  
                    start++;
                    end--;
                }

                // if we still have a ] at the end, there's no assembly info. 
                if (typeName[end] != ']') {
                    int commaCount = 0;                            
                    for(int index = end; index >= start; index--) {
                        if( typeName[index] == ',') {
                            commaCount++;
                            if( commaCount == 4) {
                                result = typeName.Substring( start, index - start); 
                                break;
                            }
                        }
                    }
                }
            }

            return result;
        }
    }