< Free Open Study > 


The objects and collections included in this section all relate to the CodeModel object. The CodeModel object and its associates allow you examine the structure of a source code file without programmatically parsing the code. This set of objects is fairly complex to use and many of the objects, methods, or properties work only for Visual C# and are not supported for VB .NET. These objects provide read-only access to the structure of the source file. In my opinion, they are of limited value, except for the function of documenting your code, and therefore I did not cover them in the main body of this book.


I have included a small example of the use of the CodeModel in Appendix B.

The CodeModel object and its associated objects are for use by the C# and VB .NET languages. There is a corresponding set of objects that is for use with Visual C++. The same objects are available, except that they are prefixed by "VC" (as in "VCCodeModel").


If you are using VB .NET to write your add-in, you should look up the desired object, method, or property in MSDN to ensure that it is supported for Visual Basic before you spend time trying to use it. For example, methods such as AddVariable and AddFunction are not supported for VB .NET.

CodeAttribute (Object)

The CodeAttribute object defines the attributes of a CodeElement object in the CodeModel object. It represents one attribute related to a code element. You can add new attributes with the AddAttribute method.

CodeClass (Object)

The CodeClass object relates to a class in source code. It is part of the CodeElement object. The CodeElement object is a member of the CodeModel object.

CodeDelegate (Object)

The CodeDelegate object represents a delegate in source code.

CodeElement (Object)

The CodeElement object relates to a code element or construct in a source file. A code element can be any fragment of code. In general, this means that there is aCodeElement object for each definition or declaration statement in the source code.

CodeElements (Collection)

The CodeElements collection contains all of the code elements in a source file. You should check MSDN if you are programming your add-in in Visual Basic.

CodeEnum (Object)

The CodeEnum object relates to an enumeration in source code. Look at the "Properties, Methods, and Events" link for this object in MSDN for a more detailed description of what the object does.

CodeFunction (Object)

The CodeFunction object defines a function construct in a source file.

CodeInterface (Object)

The CodeInterface object represents an interface in source code. See the "Methods, Properties, and Events" link related to this object in MSDN for a complete definition of this object.

CodeModel (Object)

The CodeModel object is an alternative to the complex task of parsing text in a code file. However, the CodeModel object is not only very complex itself, but also many of the methods are not supported for VB .NET. The CodeModel object offers read-only access to your code structure. You can use the CodeModel object to analyze the structure of your code. In Visual C#, you can also use methods such as AddVariable and AddFunction to add code to the source file. These methods are not available to Visual Basic developers.

CodeNameSpace (Object)

The CodeNameSpace object relates to namespace declarations in a source file.

CodeParameter (Object)

The CodeParameter object relates to parameters of a function definition.

CodeProperty (Object)

The CodeProperty object relates to a property method in a source code file and determines how properties are defined in the respective languages in Visual Studio .NET.

CodeStruct (Object)

The CodeStruct object relates to a structure in a source code file. See the "Properties, Methods, and Events" link for this object in MSDN for more information on this object.

CodeType (Object)

The CodeType object relates to a class construct in a source file in the IDE. You can determine if a CodeElement implements a CodeType object with the IsCodeType property of the CodeElement object.

CodeTypeRef (Object)

The CodeTypeRef object defines the type of a construct in a source file.

CodeVariable (Object)

The CodeVariable object defines a variable construct in a source file.

FileCodeModel (Object)

The FileCodeModel and CodeModel objects provide the functionality to access the structure of the code in a project in the IDE.

 < Free Open Study > 

Writing Add-Ins for Visual Studio  .NET
Writing Add-Ins for Visual Studio .NET
ISBN: 1590590260
EAN: 2147483647
Year: 2002
Pages: 172
Authors: Les Smith © 2008-2017.
If you may any questions please contact us: