本文整理汇总了C#中IMember类的典型用法代码示例。如果您正苦于以下问题:C# IMember类的具体用法?C# IMember怎么用?C# IMember使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMember类属于命名空间,在下文中一共展示了IMember类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PaymentEntity
public PaymentEntity(ISale sale, IMember member, int paymentId = 0)
{
this.PaymentId = paymentId;
this.Sale = sale;
this.Member = member;
this.Date = DateTime.Now;
}
示例2: AddMember
/// <summary>
/// Adds another member to this set.
/// </summary>
/// <param name="memberToAdd">The member to add</param>
/// <param name="membershipDegree">Membership degree of the member. To create a crisp discrete set, this parameter would have to be always 1. Note: Do not add members with zero membership. Just avoid calling this method for the specific member at all.</param>
public void AddMember(IMember memberToAdd, double membershipDegree)
{
if(memberToAdd == null)
throw new NullReferenceException(String.Format("Parameter memberToAdd not specified in method AddMember in fuzzy set \"{0}\".", this.Caption));
if (membershipDegree < 0 || membershipDegree > 1)
throw new MembershipOutOfRangeException( String.Format("Membership degree {0} for element \"{1}\" in fuzzy set \"{2}\" does not belong to the range of <0,1>.", membershipDegree, memberToAdd.Caption, this.Caption));
_members.Add(memberToAdd, membershipDegree);
//Finds position of the specified member in the dictionary collection
//int position = _members.Keys.ToList<IMember>().FindLastIndex( delegate(IMember m) { return (m == memberToAdd); } );
//...and also into the internal implemenation
_intervals.AddInterval(new Interval(_intervals, memberToAdd.ToDecimal, membershipDegree));
object o = new object();
lock (o)
{
if (memberToAdd.ToDecimal >= ((IDiscreteDimension)_dimension).MemberCount)
((IDiscreteDimension)_dimension).MemberCount = (uint) memberToAdd.ToDecimal + 1;
}
if (_dimension.SignificantValues.Length < MaxMembersToDisplay)
{
List<decimal> significantValues = _dimension.SignificantValues.ToList<decimal>();
significantValues.Add(memberToAdd.ToDecimal);
_dimension.SignificantValues = significantValues.ToArray();
}
}
示例3: PCNarration
public static PostHandlerOutput[] PCNarration(
IDocumentSession documentSession,
IMember sender,
IRoom room,
string source)
{
documentSession.Ensure("documentSession");
sender.Ensure("sender");
room.Ensure("room");
source.Ensure("source");
source = source.Trim();
if (source.StartsWith("/", StringComparison.OrdinalIgnoreCase))
return null;
if (!sender.IsRoomPlayer(room))
return null;
var player = room.Players.SingleOrDefault(x => x.MemberId == sender.Id);
if (player == null)
return null;
var text = string.Concat(
player.CharacterName,
": ",
source);
documentSession.CreatePost(room.Id, sender.Id, null, source, "pc-narration", text);
return PostHandlerOutput.Empty;
}
示例4: getLayoutCache
private static string getLayoutCache( IMember owner )
{
MvcContext ctx = MockContext.GetOne( owner );
String content = ControllerRunner.Run( ctx, new wojilu.Web.Controller.LayoutController().Layout );
return content;
}
示例5: IsSpam
public static bool IsSpam(IMember member, string body)
{
// Members with over 50 karma are trusted automatically
if (member.Karma() >= 50)
return false;
var roles = Roles.GetRolesForUser(member.Username);
var isSpam = roles.Contains("potentialspam") || roles.Contains("newaccount") || NewAndPostsALot(member) || TextContainsSpam(body) || IsSuspiciousBehavior(body);
if (isSpam)
{
//Deduct karma
var reputationTotal = member.GetValue<int>("reputationTotal");
member.SetValue("reputationTotal", reputationTotal >= 0 ? reputationTotal - 1 : 0);
var reputationCurrent = member.GetValue<int>("reputationCurrent");
member.SetValue("reputationCurrent", reputationCurrent >= 0 ? reputationCurrent - 1 : 0);
var memberService = ApplicationContext.Current.Services.MemberService;
memberService.Save(member);
memberService.AssignRole(member.Id, "potentialspam");
}
return isSpam;
}
示例6: RollCommand
public static PostHandlerOutput[] RollCommand(
IDocumentSession documentSession,
IMember sender,
IRoom room,
string source)
{
documentSession.Ensure("documentSession");
sender.Ensure("sender");
room.Ensure("room");
source.Ensure("source");
var match = rollCommandRegex.Match(source);
if (!match.Success)
return null;
var number = int.Parse(match.Groups[1].Value);
var sides = int.Parse(match.Groups[2].Value);
var diceRolled = string.Join(
", ",
fn.RollDice(number, sides).ToArray());
var text = string.Format(
CultureInfo.CurrentUICulture,
"{0} rolled {1}d{2} with the result: {3}.",
sender.Alias,
number,
sides,
diceRolled);
documentSession.CreatePost(room.Id, sender.Id, null, source, "roll-result", text);
return PostHandlerOutput.Empty;
}
示例7: GetTestFramework
ITestFramework GetTestFramework(IMember member)
{
if (member != null) {
return GetTestFramework(member.DeclaringType);
}
return null;
}
示例8: CreateMemberResolveResult
MemberResolveResult CreateMemberResolveResult(IMember member)
{
if (member == null)
return null;
else
return new MemberResolveResult(resolver.CallingClass, resolver.CallingMember, member);
}
示例9: getIndexCache
private static string getIndexCache( IMember owner, int appId, int boardId, int pageId ) {
MvcContext ctx = MockContext.GetOne( owner, typeof( ForumApp ), appId );
ctx.route.setPage( pageId );
String content = ControllerRunner.Run( ctx, new wojilu.Web.Controller.Forum.BoardController().Show, boardId );
return content;
}
示例10: ToAppAdmin
public static String ToAppAdmin( IMember user, IMemberApp app )
{
String ownerPath = Link.GetMemberPathPrefix( user );
String appName = strUtil.TrimEnd( app.AppInfo.TypeName, "App" );
String controller = appName + "/Admin/" + appName;
return Link.AppendApp( app.AppOid, controller, "Index", -1, ownerPath );
}
示例11: IsTestMethod
public bool IsTestMethod(IMember member)
{
if (member != null) {
return member.Name.StartsWith("test");
}
return false;
}
示例12: MemberFigure
public MemberFigure(Gdk.Pixbuf icon, IMember memberInfo, bool hidden)
: base()
{
this.icon = new ImageFigure (icon);
if (memberInfo.ReturnType != null)
retval = new TextFigure (memberInfo.ReturnType.Name);
else
retval = new TextFigure (String.Empty);
name = new TextFigure (memberInfo.Name);
MemberInfo = memberInfo;
Visible = !hidden;
name.Padding = 1.0;
name.FontSize = 10;
retval.Padding = 0;
retval.FontSize = 10;
retval.FontColor = new Cairo.Color(0, 0, 1.0);
AllowFormatting = true;
Alignment = HStackAlignment.Bottom;
SetAttribute (FigureAttribute.Selectable, true);
Add (this.icon);
Add (retval);
Add (name);
}
示例13: GetBaseMembers
/// <summary>
/// Gets all base members that have the same signature.
/// </summary>
/// <returns>
/// List of base members with the same signature. The member from the derived-most base class is returned first.
/// </returns>
public static IEnumerable<IMember> GetBaseMembers(IMember member, bool includeImplementedInterfaces)
{
if (member == null)
throw new ArgumentNullException("member");
if (member.IsExplicitInterfaceImplementation && member.ImplementedInterfaceMembers.Count == 1) {
// C#-style explicit interface implementation
member = member.ImplementedInterfaceMembers[0];
yield return member;
}
SpecializedMember specializedMember = member as SpecializedMember;
member = member.MemberDefinition;
IEnumerable<IType> allBaseTypes;
if (includeImplementedInterfaces) {
allBaseTypes = member.DeclaringTypeDefinition.GetAllBaseTypes();
} else {
allBaseTypes = member.DeclaringTypeDefinition.GetNonInterfaceBaseTypes();
}
foreach (IType baseType in allBaseTypes.Reverse()) {
if (baseType == member.DeclaringTypeDefinition)
continue;
foreach (IMember baseMember in baseType.GetMembers(m => m.Name == member.Name, GetMemberOptions.IgnoreInheritedMembers)) {
if (SignatureComparer.Ordinal.Equals(member, baseMember)) {
if (specializedMember != null)
yield return SpecializedMember.Create(baseMember, specializedMember.Substitution);
else
yield return baseMember;
}
}
}
}
示例14: IsAccessible
static bool IsAccessible(IMember sourceMember, IMember targetMember)
{
if (sourceMember.IsStatic != targetMember.IsStatic)
return false;
var sourceType = sourceMember.DeclaringType;
var targetType = targetMember.DeclaringType;
switch (targetMember.Accessibility) {
case Accessibility.None:
return false;
case Accessibility.Private:
// check for members of outer classes (private members of outer classes can be accessed)
var targetTypeDefinition = targetType.GetDefinition();
for (var t = sourceType.GetDefinition(); t != null; t = t.DeclaringTypeDefinition) {
if (t.Equals(targetTypeDefinition))
return true;
}
return false;
case Accessibility.Public:
return true;
case Accessibility.Protected:
return IsProtectedAccessible(sourceType, targetType);
case Accessibility.Internal:
return IsInternalAccessible(sourceMember.ParentAssembly, targetMember.ParentAssembly);
case Accessibility.ProtectedOrInternal:
return IsInternalAccessible(sourceMember.ParentAssembly, targetMember.ParentAssembly) || IsProtectedAccessible(sourceType, targetType);
case Accessibility.ProtectedAndInternal:
return IsInternalAccessible(sourceMember.ParentAssembly, targetMember.ParentAssembly) && IsProtectedAccessible(sourceType, targetType);
default:
throw new Exception("Invalid value for Accessibility");
}
}
示例15: ReflectionParameter
public ReflectionParameter(ParameterInfo parameterInfo, IMember member)
: base(parameterInfo.Name)
{
Type type = parameterInfo.ParameterType;
this.ReturnType = ReflectionReturnType.Create(member, type, false);
if (type.IsByRef && parameterInfo.IsOut) {
this.Modifiers = ParameterModifiers.Out;
} else if (type.IsByRef) {
this.Modifiers = ParameterModifiers.Ref;
}
if (parameterInfo.IsOptional) {
this.Modifiers |= ParameterModifiers.Optional;
}
if (type.IsArray && type != typeof(Array)) {
foreach (CustomAttributeData data in CustomAttributeData.GetCustomAttributes(parameterInfo)) {
if (data.Constructor.DeclaringType.FullName == typeof(ParamArrayAttribute).FullName) {
this.Modifiers |= ParameterModifiers.Params;
break;
}
}
}
}