Click here to Skip to main content
11,923,948 members (61,445 online)
Click here to Skip to main content
Articles » Languages » VB.NET » General » Downloads


35 bookmarked

DirectCast vs. CType

, 8 Apr 2007 CPOL
When to use DirectCast vs. CType.
' <auto-generated>
'     This code was generated by a tool.
'     Runtime Version:2.0.50727.312
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated.
' </auto-generated>

Option Strict On
Option Explicit On

Namespace My.Resources
    'This class was auto-generated by the StronglyTypedResourceBuilder
    'class via a tool like ResGen or Visual Studio.
    'To add or remove a member, edit your .ResX file then rerun ResGen
    'with the /str option, or rebuild your VS project.
    '  A strongly-typed resource class, for looking up localized strings, etc.
    <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", ""),  _
     Global.System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
     Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(),  _
     Global.Microsoft.VisualBasic.HideModuleNameAttribute()>  _
    Friend Module Resources
        Private resourceMan As Global.System.Resources.ResourceManager
        Private resourceCulture As Global.System.Globalization.CultureInfo
        '  Returns the cached ResourceManager instance used by this class.
        <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)>  _
        Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
                If Object.ReferenceEquals(resourceMan, Nothing) Then
                    Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("DirectCast.Resources", GetType(Resources).Assembly)
                    resourceMan = temp
                End If
                Return resourceMan
            End Get
        End Property
        '  Overrides the current thread's CurrentUICulture property for all
        '  resource lookups using this strongly typed resource class.
        <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)>  _
        Friend Property Culture() As Global.System.Globalization.CultureInfo
                Return resourceCulture
            End Get
            Set(ByVal value As Global.System.Globalization.CultureInfo)
                resourceCulture = value
            End Set
        End Property
    End Module
End Namespace

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Tim Greenfield
Software Developer (Senior)
United States United States
I am a software architect and engineer who has been working in the industry since 1994. Although I officially started writing software many years earlier at age 11 by authoring games, graphics demos, or whatever I found interesting. I even landed my first consulting job at age 16 implementing a newly invented mathimatical algorithm for a team of researchers at the local University.

I've designed and implemented hundreds if not thousands of applications: client, web, and hybrid of all scales and was a contributing author to the Black Belt programming column of Visual Basic Programmer's Journal.

My goals when coding are always to write clean, reusable and optimized code using the latest and technology, tools and techniques.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.151125.3 | Last Updated 8 Apr 2007
Article Copyright 2007 by Tim Greenfield
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid