本文整理汇总了C#中IronRuby.Builtins.RubyModule.TryResolveClassVariable方法的典型用法代码示例。如果您正苦于以下问题:C# RubyModule.TryResolveClassVariable方法的具体用法?C# RubyModule.TryResolveClassVariable怎么用?C# RubyModule.TryResolveClassVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IronRuby.Builtins.RubyModule
的用法示例。
在下文中一共展示了RubyModule.TryResolveClassVariable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetClassVariable
public static object GetClassVariable(RubyModule/*!*/ self, [DefaultProtocol]string/*!*/ variableName) {
object value;
if (self.TryResolveClassVariable(variableName, out value) == null) {
RubyUtils.CheckClassVariableName(variableName);
throw RubyExceptions.CreateNameError(String.Format("uninitialized class variable {0} in {1}", variableName, self.Name));
}
return value;
}
示例2: ClassVariableDefined
public static bool ClassVariableDefined(RubyModule/*!*/ self, [DefaultProtocol]string/*!*/ variableName) {
RubyUtils.CheckClassVariableName(variableName);
object value;
return self.TryResolveClassVariable(variableName, out value) != null;
}
示例3: SetClassVariableInternal
private static object SetClassVariableInternal(RubyModule/*!*/ lexicalOwner, string/*!*/ name, object value) {
object oldValue;
RubyModule owner = lexicalOwner.TryResolveClassVariable(name, out oldValue);
(owner ?? lexicalOwner).SetClassVariable(name, value);
return value;
}
示例4: IsClassVariableDefined
public static bool IsClassVariableDefined(RubyModule/*!*/ self, [DefaultProtocol, NotNull]string/*!*/ variableName) {
object value;
if (self.TryResolveClassVariable(variableName, out value) == null) {
self.Context.CheckClassVariableName(variableName);
return false;
}
return true;
}
示例5: GetClassVariableInternal
private static object GetClassVariableInternal(RubyModule/*!*/ module, string/*!*/ name) {
object value;
if (module.TryResolveClassVariable(name, out value) == null) {
throw RubyExceptions.CreateNameError(String.Format("uninitialized class variable {0} in {1}", name, module.Name));
}
return value;
}