• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Scope类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Scope的典型用法代码示例。如果您正苦于以下问题:C# Scope类的具体用法?C# Scope怎么用?C# Scope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Scope类属于命名空间,在下文中一共展示了Scope类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetProperty

 public string GetProperty(string propertyName, string format, CultureInfo formatProvider, UserInfo AccessingUser, Scope AccessLevel, ref bool PropertyNotFound)
 {
     TimeZoneInfo userTimeZone = AccessingUser.Profile.PreferredTimeZone;
     switch (propertyName.ToLower())
     {
         case "current":
             if (format == string.Empty)
             {
                 format = "D";
             }
             return TimeZoneInfo.ConvertTime(DateTime.Now, userTimeZone).ToString(format, formatProvider);
         case "now":
             if (format == string.Empty)
             {
                 format = "g";
             }
             return TimeZoneInfo.ConvertTime(DateTime.Now, userTimeZone).ToString(format, formatProvider);
         case "system":
             if (format == String.Empty)
             {
                 format = "g";
             }
             return DateTime.Now.ToString(format, formatProvider);
         case "utc":
             if (format == String.Empty)
             {
                 format = "g";
             }
             return DateTime.Now.ToUniversalTime().ToString(format, formatProvider);
         default:
             PropertyNotFound = true;
             return string.Empty;
     }
 }
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:34,代码来源:DateTimePropertyAccess.cs


示例2: ExpansionContext

 private ExpansionContext(Stack<MethodBase> stack, Scope scope, NameGenerator names, IEnumerable<KeyValuePair<Sym, Expression>> env)
 {
     Stack = stack;
     Scope = scope;
     Names = names;
     Env = env.ToDictionary();
 }
开发者ID:xeno-by,项目名称:conflux,代码行数:7,代码来源:ExpansionContext.cs


示例3: GetProperty

 public string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, Entities.Users.UserInfo AccessingUser, Scope AccessLevel, ref bool PropertyNotFound)
 {
     if (dr == null)
         return string.Empty;
     object valueObject = dr[strPropertyName];
     string OutputFormat = strFormat;
     if (string.IsNullOrEmpty(strFormat))
         OutputFormat = "g";
     if (valueObject != null)
     {
         switch (valueObject.GetType().Name)
         {
             case "String":
                 return PropertyAccess.PropertyAccess.FormatString(Convert.ToString(valueObject), strFormat);
             case "Boolean":
                 return (PropertyAccess.PropertyAccess.Boolean2LocalizedYesNo(Convert.ToBoolean(valueObject), formatProvider));
             case "DateTime":
             case "Double":
             case "Single":
             case "Int32":
             case "Int64":
                 return (((IFormattable)valueObject).ToString(OutputFormat, formatProvider));
             default:
                 return PropertyAccess.PropertyAccess.FormatString(valueObject.ToString(), strFormat);
         }
     }
     else
     {
         PropertyNotFound = true;
         return string.Empty;
     }
 }
开发者ID:jackiechou,项目名称:thegioicuaban.com,代码行数:32,代码来源:DataRowPropertyAccess.cs


示例4: Scope

 // copy constructor
 // ================
 // 
 private Scope(Scope other)
     : this(new List<Utils.StoreEntry>(other.locals),
            other.esp_pos,
            new List<Utils.StoreEntry>(other.globals),
            other.func,
            new List<Utils.StoreEntry>(other.typedefs),
            new List<Utils.StoreEntry>(other.enums)) {}
开发者ID:phisiart,项目名称:C-Compiler,代码行数:10,代码来源:Environment.cs


示例5: Execute

        public void Execute(Machine machine, Stack<object> stack, Scope scope, Instruction instr)
        {
            int length;
            string name;

            switch (instr)
            {
                default:
                    throw new VMException("Something just went horribly wrong. Variable instructlet is not supposed to receive {0}", instr.ToString());

                case Instruction.SetVar:
                    length = (int)machine.TakeByte();
                    name = machine.TakeBytes(length).AsString();

                    machine.ExecuteNextInstructlet();
                    scope.SetVariable(name, stack.Pop());
                    break;

                case Instruction.GetVar:
                    length = (int)machine.TakeByte();
                    name = machine.TakeBytes((int)length).AsString();

                    stack.Push(scope.GetVariable(name));
                    break;
            }
        }
开发者ID:Spanfile,项目名称:Englang,代码行数:26,代码来源:VariableInstructlet.cs


示例6: Repository

        private static SyntaxNode Repository(SyntaxNode node, Scope scope)
        {
            //Hubo problemas con el templatecito bonito,
            //Roslyn espera que tu reemplaces una clase con otra
            //Por tanto hay que escupir la clase nada mas y annadir
            //la interfaz al scope

            var repository = node as ClassDeclarationSyntax;

            if (repository == null)
                throw new InvalidOperationException();

            //Vamos a suponer que quieres cambiar los metodos para que sean UnitOfWork
            //solo un ejemplo.
            var typeName = repository.Identifier.ToString();
            var className = typeName + "Repository";
            var interfaceName = "I" + typeName + "Repository";

            var methods = repository
                .DescendantNodes()
                .OfType<MethodDeclarationSyntax>();

            var @interface = repoInterface.Get<InterfaceDeclarationSyntax>(interfaceName)
                .AddMembers(methods
                    .Select(method => CSharp.MethodDeclaration(method.ReturnType, method.Identifier)
                        .WithParameterList(method.ParameterList)
                        .WithSemicolonToken(Roslyn.semicolon))
                    .ToArray());

            scope.AddType(@interface);

            return repoClass.Get<ClassDeclarationSyntax>(className, typeName, interfaceName)
                .AddMembers(methods.ToArray());
        }
开发者ID:mpmedia,项目名称:Excess,代码行数:34,代码来源:Extension.cs


示例7: Scope

 public Scope(BodyType bodyType, Scope parent, ReadOnlyArray<string> parameters)
 {
     _bodyType = bodyType;
     Parent = parent;
     _parameters = parameters;
     _rootScope = parent != null ? parent._rootScope : this;
 }
开发者ID:pvginkel,项目名称:Jint2,代码行数:7,代码来源:AstBuilder.Scope.cs


示例8: GetProperty

 public string GetProperty(string propertyName, string format, CultureInfo formatProvider, UserInfo AccessingUser, Scope CurrentScope, ref bool PropertyNotFound)
 {
     switch (propertyName.ToLowerInvariant())
     {
         case "url":
             return NewUrl(objParent.Language);
         case "flagsrc":
             return "/" + objParent.Language + ".gif";
         case "selected":
             return (objParent.Language == CultureInfo.CurrentCulture.Name).ToString();
         case "label":
             return Localization.GetString("Label", objParent.resourceFile);
         case "i":
             return Globals.ResolveUrl("~/images/Flags");
         case "p":
             return Globals.ResolveUrl(PathUtils.Instance.RemoveTrailingSlash(objPortal.HomeDirectory));
         case "s":
             return Globals.ResolveUrl(PathUtils.Instance.RemoveTrailingSlash(objPortal.ActiveTab.SkinPath));
         case "g":
             return Globals.ResolveUrl("~/portals/" + Globals.glbHostSkinFolder);
         default:
             PropertyNotFound = true;
             return string.Empty;
     }
 }
开发者ID:revellado,项目名称:privateSocialGroups,代码行数:25,代码来源:LanguageTokenReplace.cs


示例9: GetProperty

 public string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, Entities.Users.UserInfo AccessingUser, Scope AccessLevel, ref bool PropertyNotFound)
 {
     CultureInfo ci = formatProvider;
     if (strPropertyName.ToLower() == CultureDropDownTypes.EnglishName.ToString().ToLowerInvariant())
     {
         return PropertyAccess.PropertyAccess.FormatString(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(ci.EnglishName), strFormat);
     }
     else if (strPropertyName.ToLower() == CultureDropDownTypes.Lcid.ToString().ToLowerInvariant())
     {
         return ci.LCID.ToString();
     }
     else if (strPropertyName.ToLower() == CultureDropDownTypes.Name.ToString().ToLowerInvariant())
     {
         return PropertyAccess.PropertyAccess.FormatString(ci.Name, strFormat);
     }
     else if (strPropertyName.ToLower() == CultureDropDownTypes.NativeName.ToString().ToLowerInvariant())
     {
         return PropertyAccess.PropertyAccess.FormatString(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(ci.NativeName), strFormat);
     }
     else if (strPropertyName.ToLower() == CultureDropDownTypes.TwoLetterIsoCode.ToString().ToLowerInvariant())
     {
         return PropertyAccess.PropertyAccess.FormatString(ci.TwoLetterISOLanguageName, strFormat);
     }
     else if (strPropertyName.ToLower() == CultureDropDownTypes.ThreeLetterIsoCode.ToString().ToLowerInvariant())
     {
         return PropertyAccess.PropertyAccess.FormatString(ci.ThreeLetterISOLanguageName, strFormat);
     }
     else if (strPropertyName.ToLower() == CultureDropDownTypes.DisplayName.ToString().ToLowerInvariant())
     {
         return PropertyAccess.PropertyAccess.FormatString(ci.DisplayName, strFormat);
     }
     PropertyNotFound = true;
     return string.Empty;
 }
开发者ID:jackiechou,项目名称:thegioicuaban.com,代码行数:34,代码来源:CulturePropertyAccess.cs


示例10: IncludeToken

 private IncludeToken(Token parent, Scope scope, Span span, PreprocessorToken prepToken, string fileName, bool searchFileDir)
     : base(parent, scope, span)
 {
     _prepToken = prepToken;
     _fileName = fileName;
     _searchFileDir = searchFileDir;
 }
开发者ID:cmrazek,项目名称:ProbeNpp,代码行数:7,代码来源:IncludeToken.cs


示例11: GeneratedCodeVisitor

        public GeneratedCodeVisitor(SourceBuilder output, Dictionary<string, object> globalSymbols, NullBehaviour nullBehaviour)
        {
            _nullBehaviour = nullBehaviour;
            _source = output;

            _scope = new Scope(new Scope(null) { Variables = globalSymbols });
        }
开发者ID:smoothdeveloper,项目名称:spark,代码行数:7,代码来源:GeneratedCodeVisitor.cs


示例12: ProcessContract

        private static SyntaxNode ProcessContract(SyntaxNode node, Scope scope, SyntacticalExtension<SyntaxNode> extension)
        {
            if (extension.Kind == ExtensionKind.Code)
            {
                var block = extension.Body as BlockSyntax;
                Debug.Assert(block != null);

                List<StatementSyntax> checks = new List<StatementSyntax>();
                foreach (var st in block.Statements)
                {
                    var stExpression = st as ExpressionStatementSyntax;
                    if (stExpression == null)
                    {
                        scope.AddError("contract01", "contracts only support boolean expressions", st);
                        continue;
                    }

                    var contractCheck = ContractCheck
                        .ReplaceNodes(ContractCheck
                            .DescendantNodes()
                            .OfType<ExpressionSyntax>()
                            .Where(expr => expr.ToString() == "__condition"),

                         (oldNode, newNode) =>
                            stExpression.Expression);

                    checks.Add(contractCheck);
                }

                return CSharp.Block(checks);
            }

            scope.AddError("contract02", "contract cannot return a value", node);
            return node;
        }
开发者ID:mpmedia,项目名称:Excess,代码行数:35,代码来源:Contract.cs


示例13: ProvisionAccessTokenAsync_AssertionTokenIsSigned

		public async void ProvisionAccessTokenAsync_AssertionTokenIsSigned() {
			var claims = new List<Claim>{
				new Claim( Constants.Claims.ISSUER, TestData.ISSUER ),
				new Claim( Constants.Claims.TENANT_ID, TestData.TENANT_ID.ToString() ),
				new Claim( Constants.Claims.USER_ID, TestData.USER )
			};

			var scopes = new Scope[] { };

			await m_accessTokenProvider
				.ProvisionAccessTokenAsync( claims, scopes )
				.SafeAsync();

			var publicKeys = ( await m_publicKeyDataProvider.GetAllAsync().SafeAsync() ).ToList();

			string expectedKeyId = publicKeys.First().Id.ToString();
			string actualKeyId = m_actualAssertion.Header.SigningKeyIdentifier[ 0 ].Id;

			Assert.AreEqual( 1, publicKeys.Count );
			Assert.AreEqual( expectedKeyId, actualKeyId );

			AssertClaimEquals( m_actualAssertion, Constants.Claims.ISSUER, TestData.ISSUER );
			AssertClaimEquals( m_actualAssertion, Constants.Claims.TENANT_ID, TestData.TENANT_ID.ToString() );
			AssertClaimEquals( m_actualAssertion, Constants.Claims.USER_ID, TestData.USER );
		}
开发者ID:j3parker,项目名称:D2L.Security.OAuth2,代码行数:25,代码来源:AccessTokenProviderTests.cs


示例14: SetRequestMessage

        /// <summary>
        /// Creates a <see cref="SetRequestMessage"/> with all contents.
        /// </summary>
        /// <param name="requestId">The request id.</param>
        /// <param name="version">Protocol version</param>
        /// <param name="community">Community name</param>
        /// <param name="variables">Variables</param>
        public SetRequestMessage(int requestId, VersionCode version, OctetString community, IList<Variable> variables)
        {
            if (variables == null)
            {
                throw new ArgumentNullException("variables");
            }
            
            if (community == null)
            {
                throw new ArgumentNullException("community");
            }
            
            if (version == VersionCode.V3)
            {
                throw new ArgumentException("only v1 and v2c are supported", "version");
            }
            
            Version = version;
            Header = Header.Empty;
            Parameters = SecurityParameters.Create(community);
            var pdu = new SetRequestPdu(
                requestId,
                variables);
            Scope = new Scope(pdu);
            Privacy = DefaultPrivacyProvider.DefaultPair;
 
            _bytes = this.PackMessage(null).ToBytes();
        }
开发者ID:lovmoen,项目名称:sharpsnmplib,代码行数:35,代码来源:SetRequestMessage.cs


示例15: NativeCallContext

        public NativeCallContext(NativeMethod source, IElfObject @this, params IElfObject[] args) 
        {
            Stack = new Stack<IElfObject>();

            var callScope = new Scope();
            callScope.Add("@this", @this);
            source.FuncDef.Args.Zip(args, callScope.Add);
            Scopes = new Stack<Scope>();
            Scopes.Push(callScope);

            Source = source;
            if (source.FuncDef.Args.Count() != args.Length)
            {
                throw new UnexpectedElfRuntimeException(@this.VM, String.Format(
                   "Fatal error invoking native call '{0}({1})' with args '{2}'. Reason: args count mismatch.",
                   Source.Name, Source.FuncDef.Args.StringJoin(), args.StringJoin()));
            }

            CurrentEvi = 0;
            PrevEvi = -1;
            if (source.Body.IsNullOrEmpty())
            {
                throw new UnexpectedElfRuntimeException(@this.VM, String.Format(
                   "Fatal error invoking native call '{0}'. Reason: empty method body.", Source.Name));
            } 
        }
开发者ID:xeno-by,项目名称:elf4b,代码行数:26,代码来源:NativeCallContext.cs


示例16: Execute

        public override void Execute( Command command, Thread thread, Scope scope )
        {
            TLSub sub = scope[ command.Identifier ] as TLSub;

            command.InnerBlock = sub.Block;
            thread.EnterBlock( command.InnerBlock, true, new Scope( sub.Scope ) );
        }
开发者ID:Metapyziks,项目名称:ThreadedLanguageExp,代码行数:7,代码来源:CmdCal.cs


示例17: ExitInnerBlock

 public override void ExitInnerBlock( Command command, Thread thread, Scope scope )
 {
     if ( new TLBit( command.ParamExpression.Evaluate( scope ) ).Value )
         thread.EnterBlock( command.InnerBlock );
     else
         thread.Advance();
 }
开发者ID:Metapyziks,项目名称:ThreadedLanguageExp,代码行数:7,代码来源:CmdWhl.cs


示例18: __init__

        public static void __init__(Scope/*!*/ scope, string name, string documentation) {
            scope.SetName(Symbols.Name, name);

            if (documentation != null) {
                scope.SetName(Symbols.Doc, documentation);
            }
        }
开发者ID:octavioh,项目名称:ironruby,代码行数:7,代码来源:ScopeOps.cs


示例19: DeclareVariableNode

 public DeclareVariableNode(String type, String name, SGLNode expression, Scope scope)
 {
     this.type = type;
     this.name = name;
     this.expression = expression;
     this.scope = scope;
 }
开发者ID:peppy,项目名称:sgl4cs,代码行数:7,代码来源:DeclareVariableNode.cs


示例20: attr

        /// <summary>Assigns all needed attributes to the tag</summary>
        /// <returns>This instance downcasted to base class</returns>
        public virtual IndexedTag attr(
            string abbr = null,
            string axis = null,
            string headers = null,
            Scope? scope = null,
            int? rowspan = null,
            int? colspan = null,
            string id = null,
            string @class = null,
            string style = null,
            string title = null,
            LangCode lang = null,
            string xmllang = null,
            Dir? dir = null,
            string onclick = null,
            string ondblclick = null,
            string onmousedown = null,
            string onmouseup = null,
            string onmouseover = null,
            string onmousemove = null,
            string onmouseout = null,
            string onkeypress = null,
            string onkeydown = null,
            string onkeyup = null,
            Align? align = null,
            char? @char = null,
            Length charoff = null,
            Valign? valign = null
        )
        {
            Abbr = abbr;
            Axis = axis;
            Headers = headers;
            Scope = scope;
            RowSpan = rowspan;
            ColSpan = colspan;
            Id = id;
            Class = @class;
            Style = style;
            Title = title;
            Lang = lang;
            XmlLang = xmllang;
            Dir = dir;
            OnClick = onclick;
            OnDblClick = ondblclick;
            OnMouseDown = onmousedown;
            OnMouseUp = onmouseup;
            OnMouseOver = onmouseover;
            OnMouseMove = onmousemove;
            OnMouseOut = onmouseout;
            OnKeyPress = onkeypress;
            OnKeyDown = onkeydown;
            OnKeyUp = onkeyup;
            Align = align;
            Char = @char;
            CharOff = charoff;
            Valign = valign;

            return this;
        }
开发者ID:bzure,项目名称:BSA.Net,代码行数:62,代码来源:TagTd.cs



注:本文中的Scope类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ScopedDictionary类代码示例发布时间:2022-05-24
下一篇:
C# ScintillaNet类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap