本文整理汇总了C#中MemberType类的典型用法代码示例。如果您正苦于以下问题:C# MemberType类的具体用法?C# MemberType怎么用?C# MemberType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MemberType类属于命名空间,在下文中一共展示了MemberType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Member
public Member(StreamReader sr)
{
firstName = sr.ReadLine();
lastName = sr.ReadLine();
type = (MemberType)Convert.ToInt32(sr.ReadLine());
uiStudentNumber = Convert.ToUInt32(sr.ReadLine());
memberFaculty = (Faculty)Convert.ToInt32(sr.ReadLine());
otherInstrument = sr.ReadLine();
curInstrument = (Instrument)Convert.ToInt32(sr.ReadLine());
this.bMultipleInstruments = Convert.ToBoolean(sr.ReadLine());
// write if the member plays multiple instruments
// write any other instruments that the member plays (or does not play)
int numberOfInstruments = Enum.GetValues(typeof(Member.Instrument)).Length;
if (this.bMultipleInstruments)
{
playsInstrument = new bool[Enum.GetValues(typeof(Member.Instrument)).Length];
for (int j = 0; j < numberOfInstruments; j++)
playsInstrument[j] = Convert.ToBoolean(sr.ReadLine());
}
email = sr.ReadLine();
comments = ClsStorage.ReverseCleanNewLine(sr.ReadLine());
sID = Convert.ToInt16(sr.ReadLine());
signupTime = new DateTime(Convert.ToInt64(sr.ReadLine()));
size = (ShirtSize)Convert.ToInt32(sr.ReadLine());
}
示例2: GetDefaultValueIfAny
public static bool GetDefaultValueIfAny(MemberType memberType, MetadataReader reader, Handle constantHandle, Type declaredType, IEnumerable<CustomAttributeData> customAttributes, out Object defaultValue)
{
if (!(constantHandle.IsNull(reader)))
{
defaultValue = ParseMetadataConstant(reader, constantHandle);
if (declaredType.GetTypeInfo().IsEnum)
defaultValue = Enum.ToObject(declaredType, defaultValue);
return true;
}
if (memberType != MemberType.Property) // the attributes in question cannot be applied to properties.
{
// Legacy: If there are multiple default value attribute, the desktop picks one at random (and so do we...)
foreach (CustomAttributeData cad in customAttributes)
{
Type attributeType = cad.AttributeType;
TypeInfo attributeTypeInfo = attributeType.GetTypeInfo();
if (attributeTypeInfo.IsSubclassOf(typeof(CustomConstantAttribute)))
{
CustomConstantAttribute customConstantAttribute = (CustomConstantAttribute)(cad.Instantiate());
defaultValue = customConstantAttribute.Value;
return true;
}
if (attributeType.Equals(typeof(DecimalConstantAttribute)))
{
DecimalConstantAttribute decimalConstantAttribute = (DecimalConstantAttribute)(cad.Instantiate());
defaultValue = decimalConstantAttribute.Value;
return true;
}
}
}
defaultValue = null;
return false;
}
示例3: PermissionFilter
public PermissionFilter(int memberId, MemberType memberType, string schemaId, string actionId, string filter) : base(memberId, memberType, schemaId, actionId, false)
{
if(string.IsNullOrWhiteSpace(filter))
throw new ArgumentNullException("filter");
_filter = filter.Trim();
}
示例4: MemberMetadata
public MemberMetadata(MemberInfo memberInfo)
{
_type = MemberType.None;
_memberType = null;
_mi = null;
_fp = null;
memberInfo.ThrowIfNull("memberInfo", "Parameter cannot be null.");
switch (memberInfo.MemberType)
{
case MemberTypes.Field:
_type = MemberType.Field;
_mi = memberInfo;
_memberType = (memberInfo as FieldInfo).FieldType;
break;
case MemberTypes.Property:
_type = MemberType.Property;
_memberType = (memberInfo as PropertyInfo).PropertyType;
_fp = new FastReflection.FastProperty((memberInfo as PropertyInfo), true);
_mi = memberInfo;
break;
default:
break;
}
}
示例5: GenerateSyntax
internal override void GenerateSyntax(MemberType type, ISymbol symbol, SyntaxDetail syntax, SymbolVisitorAdapter adapter)
{
foreach (var generator in _generators)
{
generator.GenerateSyntax(type, symbol, syntax, adapter);
}
}
示例6: LoadUc
private void LoadUc(MemberType usertype)
{
Control con = null;
//0 未设定 1 个人会员 2 家庭会员 3 学校会员 4 企业会员 :
switch (usertype)
{
case MemberType.Initiation:
lblUserType.Text = "初始注册会员";
break;
case MemberType.Company:
lblUserType.Text = "企业会员";
con = (Control)Page.LoadControl("~/uc/UCCompanyMemberInfo.ascx");
break;
case MemberType.Famly:
lblUserType.Text = "家庭会员";
con = (Control)Page.LoadControl("~/uc/UCFamlyMemberInfo.ascx");
break;
case MemberType.Personal:
lblUserType.Text = "个人会员";
con = (Control)Page.LoadControl("~/uc/UCPersonMemberInfo.ascx");
break;
case MemberType.School:
lblUserType.Text = "学校会员";
con = (Control)Page.LoadControl("~/uc/UCSchoolMemberInfo.ascx");
break;
}
con.ID = "uccon";
phExtentInfo.Controls.Add(con);
}
示例7: ConstantExpression
private static string ConstantExpression(Expression exp, ref MemberType type, bool? isComparisonOperator)
{
type = MemberType.Value;
ConstantExpression ce = ((ConstantExpression)exp);
if (ce.Value == null)
return "null";
else if (ce.Value.ToString().IsIn("True", "False"))//是bool值
{
var ceType = ce.Value.GetType();
var ceValue = ce.Value.ToString();
if (isComparisonOperator==true)
{
var ceNewValue = ConstantBoolDictionary.Single(it => it.Type == ceType && it.OldValue.ToLower() == ceValue.ToLower());
return ceNewValue.NewValue;
}
else
{
var ceNewValue = ConstantBoolDictionary.Single(it => it.Type == ceType && it.OldValue.ToLower() == ceValue.ToLower());
return ceNewValue.Key.ToString();
}
}
else
{
return ce.Value.ToString();
}
}
示例8: ReflectionException
public ReflectionException(string memberName, MemberType type, object obj)
: this(string.Format("Fail to find {0} {1} in {2}."
, memberName
, Enum.GetName(typeof(MemberType), type)
, obj.ToString()))
{
}
示例9: Create
public static TypeValueAccess Create(Type type, string name, MemberType memberType = MemberType.Instance | MemberType.Public | MemberType.Field | MemberType.Property)
{
//BindingFlags bindingFlags = BindingFlags.Instance;
//if ((memberType & pb.Reflection.MemberType.Public) == pb.Reflection.MemberType.Public)
// bindingFlags |= BindingFlags.Public;
//if ((memberType & pb.Reflection.MemberType.NonPublic) == pb.Reflection.MemberType.NonPublic)
// bindingFlags |= BindingFlags.NonPublic;
//foreach (MemberInfo member in type.GetMember(name, bindingFlags))
//{
// BindingFlags accessBindingFlag = 0;
// if (member.MemberType == MemberTypes.Field)
// accessBindingFlag = BindingFlags.GetField;
// else if (member.MemberType == MemberTypes.Property)
// accessBindingFlag = BindingFlags.GetProperty;
// //return new MemberAccess { SourceType = type, Name = member.Name, MemberTypes = member.MemberType, AccessBindingFlag = accessBindingFlag, MemberInfo = member };
// return new MemberAccess { SourceType = type, Name = member.Name, AccessBindingFlag = accessBindingFlag };
//}
//return null;
TypeValueInfo typeValueInfo = type.zGetTypeValueInfo(name, memberType);
if (typeValueInfo != null)
//return new MemberAccess { SourceType = type, Name = valueInfo.Name, AccessBindingFlag = GetAccessBindingFlag(valueInfo.MemberTypes) };
return new TypeValueAccess(typeValueInfo);
else
return null;
}
示例10: VisitMemberType
public virtual void VisitMemberType(MemberType memberType)
{
/*if (this.ThrowException)
{
throw (Exception)this.CreateException(memberType);
}*/
}
示例11: getMember
internal static StaffMember getMember(HttpSessionStateBase Session ,int memberID,MemberType membertype)
{
Dictionary<String, List<LibraryMemberBase>> librarymembers = Session["LibraryMembers"] as Dictionary<String, List<LibraryMemberBase>>;
List<LibraryMemberBase> staffmemberlist = librarymembers[membertype.ToString()];
StaffMember member = (StaffMember)staffmemberlist.Single(s => s.ID == memberID);
return member;
}
示例12: SetPermissionFilters
public void SetPermissionFilters(int memberId, MemberType memberType, IEnumerable<PermissionFilter> permissionFilters)
{
if(permissionFilters == null)
throw new ArgumentNullException("permissionFilters");
this.SetPermissions(MembershipHelper.DATA_ENTITY_PERMISSION, memberId, memberType, permissionFilters);
}
示例13: Add
public string Add(MemberType memtype)
{
try
{
if (memtype != null)
{
if (!IsDuplicate(string.Empty, memtype.MemberTypeName))
{
memtype.MemberTypeID = Guid.NewGuid().ToString();
memtype.DealerID = CommonConstant.GetFieldValueString(Session[CommonConstant.SessionUserID]);
memtype.UpdateDate = DateTime.Now;
memtype.CreateDate = DateTime.Now;
db.MemberTypes.Add(memtype);
db.SaveChanges();
return "Success";
}
else
{
return "This member type name already in used.";
}
}
}
catch(Exception ex)
{
LogFile.writeLogFile(DateTime.Now, "MemberTypeController", ex.ToString());
}
return "Add member type failed.";
}
示例14: Member
public Member(Lumber lumberType, MemberType memberType, Polygon geometry, string name = "")
{
this.MemberType = memberType;
this.Lumber = lumberType;
this.Geometry = geometry;
this.Name = name;
}
示例15: MemberExistsException
public MemberExistsException (string className, string memberName, MemberType existingMemberType, MemberType newMemberType, DomRegion errorLocation, string fileName)
: base (errorLocation, fileName)
{
this.className = className;
this.memberName = memberName;
this.existingMemberType = existingMemberType;
this.newMemberType = newMemberType;
}