NeutralResourcesLanguageAttribute.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / clr / src / BCL / System / Resources / NeutralResourcesLanguageAttribute.cs / 1 / NeutralResourcesLanguageAttribute.cs

                            // ==++== 
//
//   Copyright (c) Microsoft Corporation.  All rights reserved.
//
// ==--== 
/*============================================================
** 
** Class:  NeutralResourcesLanguageAttribute 
**
** 
** Purpose: Tells the ResourceManager what language your main
**          assembly's resources are written in.  The
**          ResourceManager won't try loading a satellite
**          assembly for that culture, which helps perf. 
**
** 
===========================================================*/ 

using System; 

namespace System.Resources {

    [AttributeUsage(AttributeTargets.Assembly, AllowMultiple=false)] 
[System.Runtime.InteropServices.ComVisible(true)]
    public sealed class NeutralResourcesLanguageAttribute : Attribute 
    { 
        private String _culture;
        private UltimateResourceFallbackLocation _fallbackLoc; 

        public NeutralResourcesLanguageAttribute(String cultureName)
        {
            if (cultureName == null) 
                throw new ArgumentNullException("cultureName");
 
            _culture = cultureName; 
            _fallbackLoc = UltimateResourceFallbackLocation.MainAssembly;
        } 

        public NeutralResourcesLanguageAttribute(String cultureName, UltimateResourceFallbackLocation location)
        {
            if (cultureName == null) 
                throw new ArgumentNullException("cultureName");
            if (!Enum.IsDefined(typeof(UltimateResourceFallbackLocation), location)) 
                throw new ArgumentException(Environment.GetResourceString("Arg_InvalidNeutralResourcesLanguage_FallbackLoc", location)); 

            _culture = cultureName; 
            _fallbackLoc = location;
        }

        public String CultureName { 
            get { return _culture; }
        } 
 
        public UltimateResourceFallbackLocation Location {
            get { return _fallbackLoc; } 
        }
    }
}
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK