IronRuby.Builtins.RubyStruct.GetNames C# (CSharp) Method

GetNames() public method

public GetNames ( ) : ReadOnlyCollection
return ReadOnlyCollection
        public ReadOnlyCollection<string>/*!*/ GetNames() {
            return StructInfo.GetNames();
        }

Usage Example

Example #1
0
            private RubyStruct /*!*/ ReadStruct()
            {
                RubyStruct obj = (UnmarshalNewObject() as RubyStruct);

                if (obj == null)
                {
                    throw RubyExceptions.CreateArgumentError("non-initialized struct");
                }

                var names = obj.GetNames();
                int count = ReadInt32();

                if (count != names.Count)
                {
                    throw RubyExceptions.CreateArgumentError("struct size differs");
                }

                for (int i = 0; i < count; i++)
                {
                    string name = ReadIdentifier();
                    if (name != names[i])
                    {
                        RubyClass theClass = Context.GetClassOf(obj);
                        throw RubyExceptions.CreateTypeError("struct {0} not compatible ({1} for {2})", theClass.Name, name, names[i]);
                    }
                    obj[i] = ReadAnObject(false);
                }

                return(obj);
            }
All Usage Examples Of IronRuby.Builtins.RubyStruct::GetNames