当前位置: 首页>>代码示例>>C#>>正文


C# BaseContext类代码示例

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


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

示例1: AddNewComputerSteps

 public AddNewComputerSteps(BaseContext baseContext)
     : base(baseContext)
 {
     client = new RestClient("http://computer-database.herokuapp.com/");
     request = new RestRequest("computers", Method.POST);
     newComputer = new NewComputer();
 }
开发者ID:oflorko,项目名称:BackBaseTask,代码行数:7,代码来源:AddNewComputerSteps.cs

示例2: Execute

 public override void Execute(Context _context)
 {
     // action logic here
     //if( context.target == null) return;
     context = (BaseContext) _context;
     context.alive = false;
     // Debug.Log("Destroy" + context.gameObject.name);
     // context.StartCoroutine(WaitAndDestroy() );
     GameObject.Destroy(context.gameObject);
 }
开发者ID:saygt,项目名称:samuraivillage,代码行数:10,代码来源:Do_Destroy.cs

示例3: GetRoleCodeList

        /// <summary>
        /// 根据用户编码取角色集合
        /// </summary>
        /// <param name="userCode">用户编码</param>
        /// <returns></returns>
        private static List<string> GetRoleCodeList(string userCode)
        {
            List<string> list = new List<string>();
            using (var context = new BaseContext())
            {
                if (!string.IsNullOrEmpty(userCode))
                {
                    var user = context.Users.FirstOrDefault(u => u.Code == userCode);
                    if (user != null)
                    {
                        var roleCodes = (from ru in context.RoleUsers
                                         join r in context.Roles on ru.RoleID equals r.ID
                                         where ru.UserID == user.ID
                                         select r.Code
                          ).ToList();
                        list = roleCodes;
                    }

                }
            }
            return list;
        }
开发者ID:wangchunlei,项目名称:MyGit,代码行数:27,代码来源:AuthManager.cs

示例4: Execute

    public override void Execute(Context _context)
    {
        // action logic here
        //if( context.target == null) return;
        context = (BaseContext) _context;
        context.alive = false;
        // Debug.Log("Destroy" + context.gameObject.name);
        // context.StartCoroutine(WaitAndDestroy() );
        if(context.lastHit != null){
            pc = context.lastHit.GetComponent<PlayerContext>();
            player = GameObject.FindObjectOfType(typeof(PlayerContext)) as PlayerContext;
        }

        if(context.team == 1 && pc == null)
        {
            // player.streak = 0;
        }
        else if(context.team == 1 && pc != null){
            player.streak += 1;
            DisplayBounty();
        }
        GameObject.Destroy(context.gameObject);
    }
开发者ID:saygt,项目名称:samuraivillage,代码行数:23,代码来源:Do_Die.cs

示例5: DoResolveTypeParameters

		protected virtual bool DoResolveTypeParameters ()
		{
			var tparams = CurrentTypeParameters;
			if (tparams == null)
				return true;

			var base_context = new BaseContext (this);
			for (int i = 0; i < tparams.Count; ++i) {
				var tp = tparams[i];

				if (!tp.ResolveConstraints (base_context)) {
					error = true;
					return false;
				}
			}

			if (IsPartialPart) {
				PartialContainer.CurrentTypeParameters.UpdateConstraints (this);
			}

			return true;
		}
开发者ID:fvalette,项目名称:mono,代码行数:22,代码来源:class.cs

示例6: ResolveBaseTypes

		/// <summary>
		///   This function computes the Base class and also the
		///   list of interfaces that the class or struct @c implements.
		///   
		///   The return value is an array (might be null) of
		///   interfaces implemented (as Types).
		///   
		///   The @base_class argument is set to the base object or null
		///   if this is `System.Object'. 
		/// </summary>
		protected virtual TypeSpec[] ResolveBaseTypes (out FullNamedExpression base_class)
		{
			base_class = null;
			if (type_bases == null)
				return null;

			int count = type_bases.Count;
			TypeSpec[] ifaces = null;
			var base_context = new BaseContext (this);
			for (int i = 0, j = 0; i < count; i++){
				FullNamedExpression fne = type_bases [i];

				var fne_resolved = fne.ResolveAsType (base_context);
				if (fne_resolved == null)
					continue;

				if (i == 0 && Kind == MemberKind.Class && !fne_resolved.IsInterface) {
					if (fne_resolved.BuiltinType == BuiltinTypeSpec.Type.Dynamic) {
						Report.Error (1965, Location, "Class `{0}' cannot derive from the dynamic type",
							GetSignatureForError ());

						continue;
					}
					
					base_type = fne_resolved;
					base_class = fne;
					continue;
				}

				if (ifaces == null)
					ifaces = new TypeSpec [count - i];

				if (fne_resolved.IsInterface) {
					for (int ii = 0; ii < j; ++ii) {
						if (fne_resolved == ifaces [ii]) {
							Report.Error (528, Location, "`{0}' is already listed in interface list",
								fne_resolved.GetSignatureForError ());
							break;
						}
					}

					if (Kind == MemberKind.Interface && !IsAccessibleAs (fne_resolved)) {
						Report.Error (61, fne.Location,
							"Inconsistent accessibility: base interface `{0}' is less accessible than interface `{1}'",
							fne_resolved.GetSignatureForError (), GetSignatureForError ());
					}
				} else {
					Report.SymbolRelatedToPreviousError (fne_resolved);
					if (Kind != MemberKind.Class) {
						Report.Error (527, fne.Location, "Type `{0}' in interface list is not an interface", fne_resolved.GetSignatureForError ());
					} else if (base_class != null)
						Report.Error (1721, fne.Location, "`{0}': Classes cannot have multiple base classes (`{1}' and `{2}')",
							GetSignatureForError (), base_class.GetSignatureForError (), fne_resolved.GetSignatureForError ());
					else {
						Report.Error (1722, fne.Location, "`{0}': Base class `{1}' must be specified as first",
							GetSignatureForError (), fne_resolved.GetSignatureForError ());
					}
				}

				ifaces [j++] = fne_resolved;
			}

			return ifaces;
		}
开发者ID:fvalette,项目名称:mono,代码行数:74,代码来源:class.cs

示例7: DoResolveTypeParameters

		protected virtual bool DoResolveTypeParameters ()
		{
			var tparams = MemberName.TypeParameters;
			if (tparams == null)
				return true;

			var base_context = new BaseContext (this);
			for (int i = 0; i < tparams.Count; ++i) {
				var tp = tparams[i];

				if (!tp.ResolveConstraints (base_context)) {
					error = true;
					return false;
				}

				if (IsPartialPart) {
					var pc_tp = PartialContainer.CurrentTypeParameters [i];

					tp.Create (spec, this);
					tp.Define (pc_tp);

					if (tp.OptAttributes != null) {
						if (pc_tp.OptAttributes == null)
							pc_tp.OptAttributes = tp.OptAttributes;
						else
							pc_tp.OptAttributes.Attrs.AddRange (tp.OptAttributes.Attrs);
					}
				}
			}

			if (IsPartialPart) {
				PartialContainer.CurrentTypeParameters.UpdateConstraints (this);
			}

			return true;
		}
开发者ID:0xd4d,项目名称:NRefactory,代码行数:36,代码来源:class.cs

示例8: DoResolveTypeParameters

		protected virtual bool DoResolveTypeParameters ()
		{
			if (CurrentTypeParameters == null)
				return true;

			if (PartialContainer != this)
				throw new InternalErrorException ();

			var base_context = new BaseContext (this);
			foreach (TypeParameter type_param in CurrentTypeParameters) {
				if (!type_param.ResolveConstraints (base_context)) {
					error = true;
					return false;
				}
			}

			if (partial_parts != null) {
				foreach (TypeContainer part in partial_parts)
					UpdateTypeParameterConstraints (part);
			}

			return true;
		}
开发者ID:jordanbtucker,项目名称:mono,代码行数:23,代码来源:class.cs

示例9: DoResolveTypeParameters

		protected virtual bool DoResolveTypeParameters ()
		{
			var tparams = CurrentTypeParameters;
			if (tparams == null)
				return true;

			if (PartialContainer != this)
				throw new InternalErrorException ();

			var base_context = new BaseContext (this);
			for (int i = 0; i < tparams.Count; ++i) {
				var tp = tparams[i];

				if (!tp.ResolveConstraints (base_context)) {
					error = true;
					return false;
				}
			}

			if (partial_parts != null) {
				foreach (TypeContainer part in partial_parts)
					UpdateTypeParameterConstraints (part);
			}

			return true;
		}
开发者ID:agallero,项目名称:mono,代码行数:26,代码来源:class.cs

示例10: ResolveBaseTypes

		/// <summary>
		///   This function computes the Base class and also the
		///   list of interfaces that the class or struct @c implements.
		///   
		///   The return value is an array (might be null) of
		///   interfaces implemented (as Types).
		///   
		///   The @base_class argument is set to the base object or null
		///   if this is `System.Object'. 
		/// </summary>
		protected virtual TypeExpr[] ResolveBaseTypes (out TypeExpr base_class)
		{
			base_class = null;
			if (type_bases == null)
				return null;

			int count = type_bases.Count;
			TypeExpr [] ifaces = null;
			IMemberContext base_context = new BaseContext (this);
			for (int i = 0, j = 0; i < count; i++){
				FullNamedExpression fne = (FullNamedExpression) type_bases [i];

				//
				// Standard ResolveAsTypeTerminal cannot be used in this case because
				// it does ObsoleteAttribute and constraint checks which require
				// base type to be set
				//
				TypeExpr fne_resolved = fne.ResolveAsBaseTerminal (base_context, false);
				if (fne_resolved == null)
					continue;

				if (i == 0 && Kind == Kind.Class && !fne_resolved.Type.IsInterface) {
					if (fne_resolved is DynamicTypeExpr)
						Report.Error (1965, Location, "Class `{0}' cannot derive from the dynamic type",
							GetSignatureForError ());
					else
						base_class = fne_resolved;
					continue;
				}

				if (ifaces == null)
					ifaces = new TypeExpr [count - i];

				if (fne_resolved.Type.IsInterface) {
					for (int ii = 0; ii < j; ++ii) {
						if (TypeManager.IsEqual (fne_resolved.Type, ifaces [ii].Type)) {
							Report.Error (528, Location, "`{0}' is already listed in interface list",
								fne_resolved.GetSignatureForError ());
							break;
						}
					}

					if (Kind == Kind.Interface && !IsAccessibleAs (fne_resolved.Type)) {
						Report.Error (61, fne.Location,
							"Inconsistent accessibility: base interface `{0}' is less accessible than interface `{1}'",
							fne_resolved.GetSignatureForError (), GetSignatureForError ());
					}
				} else {
					Report.SymbolRelatedToPreviousError (fne_resolved.Type);
					if (Kind != Kind.Class) {
						Report.Error (527, fne.Location, "Type `{0}' in interface list is not an interface", fne_resolved.GetSignatureForError ());
					} else if (base_class != null)
						Report.Error (1721, fne.Location, "`{0}': Classes cannot have multiple base classes (`{1}' and `{2}')",
							GetSignatureForError (), base_class.GetSignatureForError (), fne_resolved.GetSignatureForError ());
					else {
						Report.Error (1722, fne.Location, "`{0}': Base class `{1}' must be specified as first",
							GetSignatureForError (), fne_resolved.GetSignatureForError ());
					}
				}

				ifaces [j++] = fne_resolved;
			}

			return ifaces;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:75,代码来源:class.cs


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